IncomeStatistics.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. /**
  3. * Niushop商城系统 - 团队十年电商经验汇集巨献!
  4. * =========================================================
  5. * Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
  6. * ----------------------------------------------
  7. * 官方网址: https://www.niushop.com
  8. * =========================================================
  9. */
  10. namespace addon\giftcard\event;
  11. use addon\giftcard\model\order\GiftCardOrder;
  12. /**
  13. * 资金收入统计
  14. */
  15. class IncomeStatistics
  16. {
  17. public function handle($param)
  18. {
  19. $money = ( new GiftCardOrder() )->getOrderSum(
  20. [
  21. [ 'go.site_id', '=', $param[ 'site_id' ] ],
  22. [ 'go.pay_time', 'between', [ $param[ 'start_time' ], $param[ 'end_time' ] ] ]
  23. ], 'p.pay_money', 'go', [
  24. [
  25. 'pay p', 'go.out_trade_no = p.out_trade_no', 'left'
  26. ]
  27. ])[ 'data' ];
  28. return [
  29. [
  30. 'title' => '礼品卡订单',
  31. 'value' => $money,
  32. 'desc' => '统计时间内,所有礼品卡订单金额之和',
  33. 'url' => 'giftcard://shop/order/order',
  34. ]
  35. ];
  36. }
  37. }