RaiseOldGoodsOrder.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <?php
  2. namespace app\admin\controller\raise;
  3. use app\admin\controller\BaseController;
  4. use app\admin\server\raise\RaiseOldGoodsOrderServer;
  5. class RaiseOldGoodsOrder extends BaseController
  6. {
  7. /**
  8. * Notes:订单列表
  9. * @return \support\Response
  10. * User: ZQ
  11. * Date: 2022/10/14
  12. */
  13. public function getOrderList()
  14. {
  15. [$page, $limit] = $this->getPage();
  16. $keywords = $this->request->get('keywords');//订单号
  17. $result = RaiseOldGoodsOrderServer::getOrderList($page, $limit, $keywords);
  18. return json_success($result, '成功');
  19. }
  20. /**
  21. * Notes:订单详情
  22. * @return \support\Response
  23. * User: ZQ
  24. * Date: 2022/11/1
  25. */
  26. public function getOrderInfo()
  27. {
  28. $order_id = $this->request->get('order_id');
  29. $result = RaiseOldGoodsOrderServer::getOrderInfo($order_id);
  30. if ($result){
  31. return json_success($result, '获取成功');
  32. }else{
  33. throw new \Exception('获取失败!');
  34. }
  35. }
  36. /**
  37. * Notes:修改订单
  38. * @return \support\Response
  39. * User: ZQ
  40. * Date: 2022/11/1
  41. */
  42. public function updateOrder()
  43. {
  44. $order_id = $this->request->post('order_id');
  45. $order_address = $this->request->post('order_address');
  46. $order_address_mobile = $this->request->post('order_address_mobile');
  47. $order_address_nickname = $this->request->post('order_address_nickname');
  48. $order_remke = $this->request->post('order_remke','');
  49. $order_express = $this->request->post('order_express');
  50. $order_express_name = $this->request->post('order_express_name');
  51. $order = RaiseOldGoodsOrderServer::getOrderInfo($order_id);
  52. if (empty($order)){
  53. throw new \Exception('订单不存在!');
  54. }
  55. if ($order['order_pay_status'] == 0){
  56. throw new \Exception('订单未支付!');
  57. }elseif ($order['order_pay_status'] == 2){
  58. throw new \Exception('订单支付失败!');
  59. }elseif ($order['order_pay_status'] == 3){
  60. throw new \Exception('订单已取消!');
  61. }elseif ($order['order_deliver_id'] == 1 && $order['order_status'] == 1){
  62. throw new \Exception('订单已发货!');
  63. }
  64. $result = RaiseOldGoodsOrderServer::orderUpdate($order_id,$order_address,$order_address_mobile,$order_address_nickname,$order_remke,$order_express,$order_express_name);
  65. if ($result){
  66. return json_success($result, '发货成功');
  67. }else{
  68. throw new \Exception('发货失败!');
  69. }
  70. }
  71. /**
  72. * Notes:修改订单支付状态
  73. * @return \support\Response
  74. * User: YCP
  75. * Date: 2022/11/28
  76. */
  77. public function updatePayStatus()
  78. {
  79. $order_id = $this->request->post('order_id');
  80. $order_pay_status = $this->request->post('order_pay_status');
  81. if(!$order_id){
  82. throw new \Exception('订单ID不能为空');
  83. }
  84. $result = RaiseOldGoodsOrderServer::updatePayStatus($order_id, $order_pay_status);
  85. return json_success($result, '修改成功');
  86. }
  87. }