ServiceOrderController.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <?php
  2. namespace app\api\controller;
  3. use app\api\lists\recharge\ServiceOrderLists;
  4. use app\api\logic\ServiceOrderLogic;
  5. use app\api\validate\ServiceOrderValidate;
  6. /**
  7. * 订单类
  8. */
  9. class ServiceOrderController extends BaseApiController
  10. {
  11. /**
  12. * 订单列表
  13. * @return \think\response\Json
  14. */
  15. public function lists()
  16. {
  17. return $this->dataLists(new ServiceOrderLists());
  18. }
  19. /**
  20. * 订单详情
  21. * @return \think\response\Json
  22. */
  23. public function detail()
  24. {
  25. $params = (new ServiceOrderValidate())->goCheck('detail',[
  26. 'user_id' => $this->userId,
  27. ]);
  28. $result = ServiceOrderLogic::detail($params);
  29. if (false === $result) {
  30. return $this->fail(ServiceOrderLogic::getError());
  31. }
  32. return $this->data($result);
  33. }
  34. /**
  35. * 提交订单
  36. * @return \think\response\Json
  37. */
  38. public function submitOrder()
  39. {
  40. $params = (new ServiceOrderValidate())->post()->goCheck('add', [
  41. 'user_id' => $this->userId,
  42. 'terminal' => $this->userInfo['terminal'],
  43. 'user_info' => $this->userInfo
  44. ]);
  45. $result = ServiceOrderLogic::submitOrder($params);
  46. if (false === $result) {
  47. return $this->fail(ServiceOrderLogic::getError());
  48. }
  49. return $this->data($result);
  50. }
  51. /**
  52. * 取消订单
  53. * @return \think\response\Json
  54. */
  55. public function cancelOrder()
  56. {
  57. $params = (new ServiceOrderValidate())->post()->goCheck('cancel', [
  58. 'user_id' => $this->userId,
  59. 'terminal' => $this->userInfo['terminal'],
  60. 'user_info' => $this->userInfo
  61. ]);
  62. $result = ServiceOrderLogic::cancelOrder($params);
  63. if (false === $result) {
  64. return $this->fail(ServiceOrderLogic::getError());
  65. }
  66. return $this->success('取消成功', [], 1, 1);
  67. }
  68. /**
  69. * 确认报价订单
  70. * @return \think\response\Json
  71. */
  72. public function confirmOrder()
  73. {
  74. $params = (new ServiceOrderValidate())->post()->goCheck('price', [
  75. 'user_id' => $this->userId,
  76. 'user_info' => $this->userInfo
  77. ]);
  78. $result = ServiceOrderLogic::confirmOrder($params);
  79. if (false === $result) {
  80. return $this->fail(ServiceOrderLogic::getError());
  81. }
  82. return $this->success('已确认报价,师傅即将开始服务', [], 1, 1);
  83. }
  84. /**
  85. * 用户确认服务完成
  86. * @return \think\response\Json
  87. */
  88. public function confirmServiceFinish()
  89. {
  90. $params = (new ServiceOrderValidate())->post()->goCheck('finished', [
  91. 'user_id' => $this->userId,
  92. 'user_info' => $this->userInfo
  93. ]);
  94. $result = ServiceOrderLogic::confirmServiceFinish($params);
  95. if (false === $result) {
  96. return $this->fail(ServiceOrderLogic::getError());
  97. }
  98. return $this->success('已确认服务完成', [], 1, 1);
  99. }
  100. public function queryEffective()
  101. {
  102. $params = (new ServiceOrderValidate())->post()->goCheck('queryEffective', [
  103. 'user_id' => $this->userId,
  104. 'user_info' => $this->userInfo
  105. ]);
  106. $result = ServiceOrderLogic::queryEffective($params);
  107. if (false === $result) {
  108. return $this->fail(ServiceOrderLogic::getError());
  109. }
  110. return $this->success('已确认服务完成', [], 1, 1);
  111. }
  112. }