Play.php 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <?php
  2. namespace app\admin\controller\life;
  3. use app\admin\controller\BaseController;
  4. use app\admin\server\life\PlayServer;
  5. class Play extends BaseController
  6. {
  7. /**
  8. * Notes:获取农庄美食/采摘游玩列表
  9. * @return \support\Response
  10. * User: ZQ
  11. * Date: 2022/10/18
  12. */
  13. public function getPlayList()
  14. {
  15. [$page, $limit] = $this->getPage();
  16. $keywords = $this->request->get('keywords');
  17. $result = PlayServer::getPlayList($page, $limit, $keywords);
  18. return json_success($result, '成功');
  19. }
  20. /**
  21. * Notes:获取所有农庄美食/采摘游玩单品
  22. * @return \support\Response
  23. * User: ZQ
  24. * Date: 2022/10/18
  25. */
  26. public function getPlayAll()
  27. {
  28. // $play_category_id = $this->request->get('play_category_id');
  29. $result = PlayServer::getPlayAll();
  30. return json_success($result, '成功');
  31. }
  32. /**
  33. * Notes:修改农庄美食/采摘游玩
  34. * @return \support\Response
  35. * User: ZQ
  36. * Date: 2022/10/18
  37. */
  38. public function updatePlay()
  39. {
  40. $play_id = $this->request->post('play_id');
  41. $play_name = $this->request->post('play_name');
  42. $play_img = $this->request->post('play_img');
  43. $play_price = $this->request->post('play_price');
  44. $play_shop_id = $this->request->post('play_shop_id');
  45. $play_valid = $this->request->post('play_valid','');
  46. $play_time = $this->request->post('play_time','');
  47. $play_type = $this->request->post('play_type');
  48. $play_package = $this->request->post('play_package','');
  49. $play_label = $this->request->post('play_label');
  50. $play_content = $this->request->post('play_content');
  51. $play_category = $this->request->post('play_category');
  52. $play_status = $this->request->post('play_status');
  53. $admin_id = $this->request->admin_id;
  54. $this->validateCheck('life\PlayValidate', ['play_id'=>$play_id,'play_name'=>$play_name,'play_img'=>$play_img,'play_price'=>$play_price,'play_shop_id'=>$play_shop_id,'play_valid'=>$play_valid,'play_time'=>$play_time,'play_type'=>$play_type,'play_label'=>$play_label,'play_status'=>$play_status,'play_content'=>$play_content,'play_category'=>$play_category], 'update');
  55. $result = PlayServer::updatePlay($play_id, $play_name, $play_img, $play_price, $play_shop_id, $play_valid, $play_time, $play_type, $play_package, $play_label, $play_status, $play_content, $play_category, $admin_id);
  56. return json_success($result, '修改成功');
  57. }
  58. /**
  59. * Notes:删除农庄美食/采摘游玩
  60. * @return \support\Response
  61. * User: ZQ
  62. * Date: 2022/10/18
  63. */
  64. public function delPlay()
  65. {
  66. $play_id = $this->request->get('play_id');
  67. $admin_id = $this->request->admin_id;
  68. $this->validateCheck('life\PlayValidate', ['play_id' => $play_id], 'info');
  69. $result = PlayServer::delPlay($play_id,$admin_id);
  70. if ($result){
  71. return json_success($result, '删除成功');
  72. }else{
  73. throw new \Exception('删除失败!');
  74. }
  75. }
  76. /**
  77. * Notes:添加农庄美食/采摘游玩
  78. * @return \support\Response
  79. * User: ZQ
  80. * Date: 2022/10/18
  81. */
  82. public function addPlay()
  83. {
  84. $play_name = $this->request->post('play_name');
  85. $play_img = $this->request->post('play_img');
  86. $play_price = $this->request->post('play_price');
  87. $play_shop_id = $this->request->post('play_shop_id');
  88. $play_valid = $this->request->post('play_valid','');
  89. $play_time = $this->request->post('play_time','');
  90. $play_type = $this->request->post('play_type');
  91. $play_package = $this->request->post('play_package','');
  92. $play_label = $this->request->post('play_label');
  93. $play_content = $this->request->post('play_content');
  94. $play_status = $this->request->post('play_status');
  95. $play_category = $this->request->post('play_category');
  96. $admin_id = $this->request->admin_id;
  97. $this->validateCheck('life\PlayValidate', ['play_name'=>$play_name,'play_img'=>$play_img,'play_price'=>$play_price,'play_shop_id'=>$play_shop_id,'play_valid'=>$play_valid,'play_time'=>$play_time,'play_type'=>$play_type,'play_label'=>$play_label,'play_status'=>$play_status,'play_content'=>$play_content,'play_category'=>$play_category], 'create');
  98. $result = PlayServer::insertPlay($play_name, $play_img, $play_price, $play_shop_id, $play_valid, $play_time, $play_type, $play_package, $play_label, $play_status, $play_content, $play_category, $admin_id);
  99. return json_success($result, '添加成功');
  100. }
  101. /**
  102. * Notes:查询农庄美食/采摘游玩详情
  103. * @return \support\Response
  104. * User: ZQ
  105. * Date: 2022/10/18
  106. */
  107. public function playInfo()
  108. {
  109. $play_id = $this->request->get('play_id');
  110. $this->validateCheck('life\PlayValidate', ['play_id' => $play_id], 'info');
  111. $result = PlayServer::playInfo($play_id);
  112. return json_success($result, '成功');
  113. }
  114. /**
  115. * Notes:农庄美食/采摘游玩上架下架
  116. * @return \support\Response
  117. * User: ZQ
  118. * Date: 2022/10/18
  119. */
  120. public function updateStatus()
  121. {
  122. $play_id = $this->request->get('play_id');
  123. $play_status = $this->request->get('play_status');
  124. $this->validateCheck('life\PlayValidate', ['play_id' => $play_id], 'info');
  125. $result = PlayServer::updateStatus($play_id, $play_status);
  126. return json_success($result, '修改成功');
  127. }
  128. }