IntegralOrderController.php 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <?php
  2. namespace app\shopapi\controller;
  3. use app\common\model\IntegralOrder;
  4. use app\common\service\WechatMiniExpressSendSyncService;
  5. use app\shopapi\lists\IntegralOrderLists;
  6. use app\shopapi\logic\IntegralOrderLogic;
  7. use app\shopapi\validate\IntegralOrderValidate;
  8. use app\shopapi\validate\IntegralPlaceOrderValidate;
  9. /**
  10. * 积分商城订单
  11. * Class IntegralOrder
  12. * @package app\api\controller
  13. */
  14. class IntegralOrderController extends BaseShopController
  15. {
  16. /**
  17. * @notes 订单列表
  18. * @return \think\response\Json
  19. * @throws \think\db\exception\DataNotFoundException
  20. * @throws \think\db\exception\DbException
  21. * @throws \think\db\exception\ModelNotFoundException
  22. * @author 段誉
  23. * @date 2022/3/2 9:39
  24. */
  25. public function lists()
  26. {
  27. return $this->dataLists(new IntegralOrderLists());
  28. }
  29. /**
  30. * @notes 结算订单
  31. * @return \think\response\Json
  32. * @throws \think\db\exception\DataNotFoundException
  33. * @throws \think\db\exception\ModelNotFoundException
  34. * @author 段誉
  35. * @date 2022/3/2 9:51
  36. */
  37. public function settlement()
  38. {
  39. $params = (new IntegralPlaceOrderValidate())->goCheck('settlement', ['user_id' => $this->userId]);
  40. $result = IntegralOrderLogic::settlement($params);
  41. return $this->success('获取成功', $result);
  42. }
  43. /**
  44. * @notes 提交订单
  45. * @return \think\response\Json
  46. * @author 段誉
  47. * @date 2022/3/31 12:14
  48. */
  49. public function submitOrder()
  50. {
  51. $params = (new IntegralPlaceOrderValidate())->post()->goCheck('submit', [
  52. 'user_id' => $this->userId,
  53. 'terminal' => $this->userInfo['terminal'],
  54. ]);
  55. $result = IntegralOrderLogic::submitOrder($params);
  56. if (false === $result) {
  57. return $this->fail(IntegralOrderLogic::getError());
  58. }
  59. return $this->success('提交成功', $result);
  60. }
  61. /**
  62. * @notes 订单详情
  63. * @return \think\response\Json
  64. * @author 段誉
  65. * @date 2022/3/2 10:23
  66. */
  67. public function detail()
  68. {
  69. $params = (new IntegralOrderValidate())->goCheck('detail', ['user_id' => $this->userId]);
  70. $result = IntegralOrderLogic::detail($params['id']);
  71. return $this->success('获取成功', $result);
  72. }
  73. /**
  74. * @notes 取消订单
  75. * @return \think\response\Json
  76. * @throws \think\db\exception\DataNotFoundException
  77. * @throws \think\db\exception\DbException
  78. * @throws \think\db\exception\ModelNotFoundException
  79. * @author 段誉
  80. * @date 2022/3/3 14:57
  81. */
  82. public function cancel()
  83. {
  84. $params = (new IntegralOrderValidate())->post()->goCheck('cancel', ['user_id' => $this->userId]);
  85. $result = IntegralOrderLogic::cancel($params['id']);
  86. if (false === $result) {
  87. return $this->fail(IntegralOrderLogic::getError());
  88. }
  89. return $this->success('取消成功');
  90. }
  91. /**
  92. * @notes 确认收货
  93. * @return \think\response\Json
  94. * @author 段誉
  95. * @date 2022/3/2 10:59
  96. */
  97. public function confirm()
  98. {
  99. $params = (new IntegralOrderValidate())->post()->goCheck('confirm', ['user_id' => $this->userId]);
  100. IntegralOrderLogic::confirm($params['id'], $this->userId);
  101. return $this->success('确认成功');
  102. }
  103. /**
  104. * @notes 删除订单
  105. * @return \think\response\Json
  106. * @author 段誉
  107. * @date 2022/3/2 10:59
  108. */
  109. public function del()
  110. {
  111. $params = (new IntegralOrderValidate())->post()->goCheck('del', ['user_id' => $this->userId]);
  112. IntegralOrderLogic::del($params['id']);
  113. return $this->success('删除成功');
  114. }
  115. /**
  116. * @notes 查看物流
  117. * @return \think\response\Json
  118. * @author 段誉
  119. * @date 2022/3/3 17:31
  120. */
  121. public function orderTraces()
  122. {
  123. $params = (new IntegralOrderValidate())->goCheck('traces', ['user_id' => $this->userId]);
  124. $result = IntegralOrderLogic::orderTraces($params['id']);
  125. return $this->success('获取成功', $result);
  126. }
  127. /**
  128. * @notes 微信同步发货 查询
  129. * @return \think\response\Json
  130. * @author lbzy
  131. * @datetime 2023-09-07 15:27:17
  132. */
  133. function wechatSyncCheck()
  134. {
  135. $id = $this->request->get('id');
  136. $order = IntegralOrder::where('id', $id)->where('user_id', $this->userId)->findOrEmpty();
  137. $result = WechatMiniExpressSendSyncService::wechatSyncCheck($order);
  138. if (! $result) {
  139. return $this->fail('获取失败');
  140. }
  141. return $this->success('成功', $result);
  142. }
  143. /**
  144. * @notes 微信确认收货 获取详情
  145. * @return \think\response\Json
  146. * @author lbzy
  147. * @datetime 2023-09-05 09:51:41
  148. */
  149. function wxReceiveDetail()
  150. {
  151. return $this->success('获取成功', IntegralOrderLogic::wxReceiveDetail(input('order_id/d'), $this->userId));
  152. }
  153. }