OrderServices.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\services\cashier;
  12. use app\services\BaseServices;
  13. use app\services\order\StoreCartServices;
  14. /**
  15. * 收银台订单和挂单Services
  16. */
  17. class OrderServices extends BaseServices
  18. {
  19. /**
  20. * 获取收银订单用户
  21. * @param int $storeId
  22. * @param int $cashierId
  23. * @return array
  24. */
  25. public function getOrderUserList(int $storeId, int $cashierId = 0)
  26. {
  27. /** @var StoreCartServices $cartServices */
  28. $cartServices = app()->make(StoreCartServices::class);
  29. $list1 = $cartServices->getHangOrder($storeId, $cashierId)->order('add_time desc')->select()->toArray();
  30. foreach ($list1 as &$item) {
  31. $item['is_check'] = 0;
  32. }
  33. $uids = [];
  34. if ($list1){
  35. $uids = array_unique(array_column($list1, 'uid'));
  36. }
  37. $list2 = [];
  38. // /** @var StoreOrderServices $orderService */
  39. // $orderService = app()->make(StoreOrderServices::class);
  40. // $list2 = $orderService->getOrderHistoryList($storeId, $cashierId, $uids);
  41. // foreach ($list2 as &$item) {
  42. // $item['is_check'] = 1;
  43. // }
  44. [$microsecond, $sec] = explode(" ", microtime());
  45. $touristUid = round($microsecond * 10000);
  46. $list0 = [[
  47. 'is_check' => 1,
  48. 'tourist_uid' => $touristUid,
  49. 'uid' => 0,
  50. 'nickname' => '',
  51. 'avatar' => '',
  52. 'staff_id' => $cashierId,
  53. 'store_id' => $storeId,
  54. 'cart_id' => '',
  55. 'add_time' => time()
  56. ]];
  57. return array_merge($list0, $list1, $list2);
  58. }
  59. }