1
0

ServiceOrderController.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. }