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.

42 lines
1.2 KiB

5 years ago
5 years ago
  1. <?php
  2. namespace App\Service\v3\Implementations;
  3. use App\Service\v3\Interfaces\WithdrawalListServiceInterface;
  4. use App\Model\v3\StoreWithdrawal;
  5. class WithdrawalListService implements WithdrawalListServiceInterface
  6. {
  7. public function do()
  8. {
  9. // TODO: Implement do() method.
  10. }
  11. public function check()
  12. {
  13. // TODO: Implement check() method.
  14. }
  15. public function undo()
  16. {
  17. // TODO: Implement undo() method.
  18. }
  19. public function getListByStore($storeId, $page=1, $pagesize=10 ,$startTime = '',$endTime = '')
  20. {
  21. $builder = StoreWithdrawal::query()->where('store_id',$storeId);
  22. // if(!empty($startTime) && !empty($endTime)){
  23. // $builder->whereBetween('created_at',[$startTime,$endTime]);
  24. // }
  25. if (!empty($startTime)) {
  26. $builder->where('created_at', '>=', $startTime);
  27. }
  28. if (!empty($endTime)) {
  29. $builder->where('created_at', '<=', $endTime);
  30. }
  31. $paginate = $builder->orderBy('created_at', 'desc')->paginate($pagesize);
  32. $orders = $paginate->toArray();
  33. return ['has_more_pages' => $paginate->hasMorePages(), 'orders' => $orders['data']];
  34. }
  35. }