1
0

ServiceOrderController.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. public function lists()
  12. {
  13. return $this->dataLists(new ServiceOrderLists());
  14. }
  15. public function detail()
  16. {
  17. $params = (new ServiceOrderValidate())->goCheck('detail',[
  18. 'user_id' => $this->userId,
  19. ]);
  20. $result = ServiceOrderLogic::detail($params);
  21. if (false === $result) {
  22. return $this->fail(ServiceOrderLogic::getError());
  23. }
  24. return $this->data($result);
  25. }
  26. public function submitOrder()
  27. {
  28. $params = (new ServiceOrderValidate())->post()->goCheck('add', [
  29. 'user_id' => $this->userId,
  30. 'terminal' => $this->userInfo['terminal'],
  31. 'user_info' => $this->userInfo
  32. ]);
  33. $result = ServiceOrderLogic::submitOrder($params);
  34. if (false === $result) {
  35. return $this->fail(ServiceOrderLogic::getError());
  36. }
  37. return $this->data($result);
  38. }
  39. }