FarmLandOrder.php 2.0 KB

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