Order.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?php
  2. namespace app\admin\controller\travel;
  3. use app\admin\controller\BaseController;
  4. use app\admin\server\travel\OrderServer;
  5. use app\admin\model\UserTravelers;
  6. class Order extends BaseController
  7. {
  8. /**
  9. * Notes:获取订单列表
  10. * @return \support\Response
  11. * User: YCP
  12. * Date: 2022/10/21
  13. */
  14. public function getOrderList()
  15. {
  16. [$page, $limit] = $this->getPage();
  17. $keywords = $this->request->get('keywords');
  18. $user_id = $this->request->user_id;
  19. $result = OrderServer::getOrderList($page, $limit,$keywords);
  20. return json_success($result, '成功');
  21. }
  22. /**
  23. * Notes:订单详情
  24. * @return \support\Response
  25. * User: YCP
  26. * Date: 2022/10/21
  27. */
  28. public function getOrderInfo()
  29. {
  30. $order_id = $this->request->get('order_id');
  31. if(!$order_id){
  32. throw new \Exception('订单ID不能为空');
  33. }
  34. $result = OrderServer::orderInfo($order_id);
  35. $ids = explode(',',$result['order_travelers']);
  36. $result['order_travelers_list'] = UserTravelers::whereIn('travelers_id',$ids)->get();
  37. if ($result){
  38. return json_success($result, '获取成功');
  39. }else{
  40. throw new \Exception('获取失败!');
  41. }
  42. }
  43. /**
  44. * Notes:修改订单支付状态
  45. * @return \support\Response
  46. * User: YCP
  47. * Date: 2022/11/28
  48. */
  49. public function updatePayStatus()
  50. {
  51. $order_id = $this->request->post('order_id');
  52. $order_pay_status = $this->request->post('order_pay_status');
  53. if(!$order_id){
  54. throw new \Exception('订单ID不能为空');
  55. }
  56. $result = OrderServer::updatePayStatus($order_id, $order_pay_status);
  57. return json_success($result, '修改成功');
  58. }
  59. /**
  60. * Notes:修改订单状态
  61. * @return \support\Response
  62. * User: YCP
  63. * Date: 2022/11/28
  64. */
  65. public function updateOrderStatus()
  66. {
  67. $order_id = $this->request->post('order_id');
  68. $order_status = $this->request->post('order_status');
  69. $order_reject_reason = $this->request->post('order_reject_reason','');
  70. if(!$order_id){
  71. throw new \Exception('订单ID不能为空');
  72. }
  73. $result = OrderServer::updateOrderStatus($order_id, $order_status, $order_reject_reason);
  74. return json_success($result, '修改成功');
  75. }
  76. }