You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.0 KiB

  1. <?php
  2. namespace App\Service\v3\Implementations;
  3. use App\Constants\v3\OrderState;
  4. use App\Model\v3\Order;
  5. use \App\Service\v3\Interfaces\OrderStatisticsServiceInterface;
  6. class OrderStatisticsService implements OrderStatisticsServiceInterface
  7. {
  8. public function do()
  9. {
  10. // TODO: Implement do() method.
  11. }
  12. public function check()
  13. {
  14. // TODO: Implement check() method.
  15. }
  16. public function undo()
  17. {
  18. // TODO: Implement undo() method.
  19. }
  20. public function countOrder($storeId,$type,$startTime = '',$endTime = '')
  21. {
  22. $builder = Order::join('lanzu_order_main','lanzu_order_main.global_order_id','lanzu_order.order_main_id')
  23. ->where('lanzu_order.store_id',$storeId);
  24. if(!empty($startTime) && !empty($endTime)){
  25. $builder->whereBetween('lanzu_order_main.created_at',[$startTime,$endTime]);
  26. }
  27. $count = $builder->whereIn('lanzu_order_main.state', OrderState::FINISH)
  28. ->where('type',$type)
  29. ->count();
  30. return $count;
  31. }
  32. }