| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- <?php
- namespace app\api\controller;
- use app\api\lists\recharge\ServiceOrderLists;
- use app\api\logic\ServiceOrderLogic;
- use app\api\validate\ServiceOrderValidate;
- /**
- * 订单类
- */
- class ServiceOrderController extends BaseApiController
- {
- /**
- * 订单列表
- * @return \think\response\Json
- */
- public function lists()
- {
- return $this->dataLists(new ServiceOrderLists());
- }
- /**
- * 订单详情
- * @return \think\response\Json
- */
- public function detail()
- {
- $params = (new ServiceOrderValidate())->goCheck('detail',[
- 'user_id' => $this->userId,
- ]);
- $result = ServiceOrderLogic::detail($params);
- if (false === $result) {
- return $this->fail(ServiceOrderLogic::getError());
- }
- return $this->data($result);
- }
- /**
- * 提交订单
- * @return \think\response\Json
- */
- public function submitOrder()
- {
- $params = (new ServiceOrderValidate())->post()->goCheck('add', [
- 'user_id' => $this->userId,
- 'terminal' => $this->userInfo['terminal'],
- 'user_info' => $this->userInfo
- ]);
- $result = ServiceOrderLogic::submitOrder($params);
- if (false === $result) {
- return $this->fail(ServiceOrderLogic::getError());
- }
- return $this->data($result);
- }
- /**
- * 取消订单
- * @return \think\response\Json
- */
- public function cancelOrder()
- {
- $params = (new ServiceOrderValidate())->post()->goCheck('cancel', [
- 'user_id' => $this->userId,
- 'terminal' => $this->userInfo['terminal'],
- 'user_info' => $this->userInfo
- ]);
- $result = ServiceOrderLogic::cancelOrder($params);
- if (false === $result) {
- return $this->fail(ServiceOrderLogic::getError());
- }
- return $this->success('取消成功', [], 1, 1);
- }
- }
|