Order.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <?php
  2. namespace addons\shopro\controller;
  3. class Order extends Base
  4. {
  5. protected $noNeedLogin = [];
  6. protected $noNeedRight = ['*'];
  7. public function index()
  8. {
  9. $params = $this->request->get();
  10. $this->success('订单列表', \addons\shopro\model\Order::getList($params));
  11. }
  12. public function detail()
  13. {
  14. $params = $this->request->get();
  15. $this->success('订单详情', \addons\shopro\model\Order::detail($params));
  16. }
  17. public function itemDetail()
  18. {
  19. $params = $this->request->get();
  20. $this->success('订单商品', \addons\shopro\model\Order::itemDetail($params));
  21. }
  22. // 即将废弃
  23. public function statusNum () {
  24. $this->success('订单数量', \addons\shopro\model\Order::statusNum());
  25. }
  26. // 取消订单
  27. public function cancel()
  28. {
  29. $params = $this->request->post();
  30. // 表单验证
  31. $this->shoproValidate($params, get_class(), 'cancel');
  32. $this->success('取消成功', \addons\shopro\model\Order::operCancel($params));
  33. }
  34. // 删除订单
  35. public function delete()
  36. {
  37. $params = $this->request->post();
  38. // 表单验证
  39. $this->shoproValidate($params, get_class(), 'delete');
  40. $this->success('删除成功', \addons\shopro\model\Order::operDelete($params));
  41. }
  42. // 确认收货
  43. public function confirm()
  44. {
  45. $params = $this->request->post();
  46. // 表单验证
  47. $this->shoproValidate($params, get_class(), 'confirm');
  48. $this->success('收货成功', \addons\shopro\model\Order::operConfirm($params));
  49. }
  50. public function comment ()
  51. {
  52. $params = $this->request->post();
  53. // 表单验证
  54. $this->shoproValidate($params, get_class(), 'comment');
  55. $this->success('评价成功', \addons\shopro\model\Order::operComment($params));
  56. }
  57. public function pre()
  58. {
  59. $params = $this->request->post();
  60. // 表单验证
  61. $this->shoproValidate($params, get_class(), 'pre');
  62. $result = \addons\shopro\model\Order::pre($params);
  63. if (isset($result['msg']) && $result['msg']) {
  64. $this->error($result['msg'], $result);
  65. } else {
  66. $this->success('计算成功', $result);
  67. }
  68. }
  69. public function createOrder()
  70. {
  71. $params = $this->request->post();
  72. // 表单验证
  73. $this->shoproValidate($params, get_class(), 'createOrder');
  74. $order = \addons\shopro\model\Order::createOrder($params);
  75. $this->success('订单添加成功', $order);
  76. }
  77. // 获取可用优惠券列表
  78. public function coupons () {
  79. $params = $this->request->post();
  80. // 表单验证
  81. $this->shoproValidate($params, get_class(), 'coupons');
  82. $coupons = \addons\shopro\model\Order::coupons($params);
  83. $this->success('获取成功', $coupons);
  84. }
  85. }