OrderServices.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. declare (strict_types=1);
  12. namespace app\services\pc;
  13. use app\services\BaseServices;
  14. use app\services\order\StoreOrderServices;
  15. class OrderServices extends BaseServices
  16. {
  17. /**
  18. * 轮询订单状态
  19. * @param string $order_id
  20. * @return bool
  21. */
  22. public function checkOrderStatus(string $order_id)
  23. {
  24. /** @var StoreOrderServices $order */
  25. $order = app()->make(StoreOrderServices::class);
  26. $res = $order->count(['order_id' => $order_id, 'paid' => 1]);
  27. if ($res) return true;
  28. return false;
  29. }
  30. /**
  31. * 获取订单列表
  32. * @param array $where
  33. * @param array|string[] $field
  34. * @param array $with
  35. * @return mixed
  36. * @throws \think\db\exception\DataNotFoundException
  37. * @throws \think\db\exception\DbException
  38. * @throws \think\db\exception\ModelNotFoundException
  39. */
  40. public function getOrderList(array $where, array $field = ['*'], array $with = [])
  41. {
  42. /** @var StoreOrderServices $order */
  43. $order = app()->make(StoreOrderServices::class);
  44. $data['list'] = $order->getOrderApiList($where, $field, $with);
  45. $data['count'] = $order->count($where);
  46. return $data;
  47. }
  48. }