OrderController.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. namespace addons\StarChain\backend\controllers;
  3. use addons\StarChain\common\services\OrderService;
  4. /**
  5. * 订单
  6. */
  7. class OrderController extends BaseController
  8. {
  9. /**
  10. * 订单列表
  11. *
  12. * @return string
  13. */
  14. public function actionIndex()
  15. {
  16. if ($this->request->isAjax) {
  17. $params = $this->request->get();
  18. $service = new OrderService(['mall_id' => $this->mall_id]);
  19. return ($data = $service->getOrderList($params)) === false
  20. ? $this->error($service->getErrorMsg())
  21. : $this->success('ok', $data);
  22. }
  23. return $this->render($this->action->id);
  24. }
  25. /**
  26. * 订单详情
  27. *
  28. * @return string
  29. */
  30. public function actionDetail()
  31. {
  32. if ($this->request->isAjax) {
  33. $id = $this->request->getBodyParam('id');
  34. $service = new OrderService(['mall_id' => $this->mall_id]);
  35. return ($data = $service->getOrderDetail($id)) === false
  36. ? $this->error($service->getErrorMsg())
  37. : $this->success('ok', $data);
  38. }
  39. }
  40. /**
  41. * 重新推送订单
  42. *
  43. * @param integer $id
  44. * @return mixed
  45. */
  46. public function actionResend(int $id)
  47. {
  48. $service = new OrderService(['mall_id' => $this->mall_id]);
  49. return $service->resendOrder($id) === false
  50. ? $this->error($service->getErrorMsg())
  51. : $this->success('ok');
  52. }
  53. }