RaiseOldGoods.php 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <?php
  2. namespace app\admin\controller\raise;
  3. use app\admin\controller\BaseController;
  4. use app\admin\server\raise\RaiseOldGoodsServer;
  5. class RaiseOldGoods extends BaseController
  6. {
  7. /**
  8. * Notes:获取养老产品列表
  9. * @return \support\Response
  10. * User: ZQ
  11. * Date: 2022/10/31
  12. */
  13. public function getGoodsList()
  14. {
  15. [$page, $limit] = $this->getPage();
  16. $keywords = $this->request->get('keywords');
  17. $result = RaiseOldGoodsServer::getGoodsList($page, $limit, $keywords);
  18. return json_success($result, '成功');
  19. }
  20. /**
  21. * Notes:获取所有养老产品
  22. * @return \support\Response
  23. * User: ZQ
  24. * Date: 2022/10/31
  25. */
  26. public function getGoodsAll()
  27. {
  28. $result = RaiseOldGoodsServer::getGoodsAll();
  29. return json_success($result, '成功');
  30. }
  31. /**
  32. * Notes:修改养老产品
  33. * @return \support\Response
  34. * User: ZQ
  35. * Date: 2022/10/31
  36. */
  37. public function updateGoods()
  38. {
  39. $goods_id = $this->request->post('goods_id');
  40. $goods_name = $this->request->post('goods_name');
  41. $goods_shop_id = $this->request->post('goods_shop_id');
  42. $goods_title = $this->request->post('goods_title','');
  43. $goods_banner = $this->request->post('goods_banner','');
  44. $goods_category_id = $this->request->post('goods_category_id');
  45. $goods_label = $this->request->post('goods_label','');
  46. $goods_price = $this->request->post('goods_price');
  47. $goods_status = $this->request->post('goods_status');
  48. $goods_time = $this->request->post('goods_time','');
  49. $goods_service_population = $this->request->post('goods_service_population','');
  50. $goods_service_consumables = $this->request->post('goods_service_consumables','');
  51. $goods_service_qualifications = $this->request->post('goods_service_qualifications','');
  52. $goods_service_explain = $this->request->post('goods_service_explain','');
  53. $goods_service_standard = $this->request->post('goods_service_standard','');
  54. $goods_service_process = $this->request->post('goods_service_process','');
  55. $goods_technological = $this->request->post('goods_technological','');
  56. $goods_tips = $this->request->post('goods_tips','');
  57. $admin_id = $this->request->admin_id;
  58. $this->validateCheck('raise\RaiseOldGoodsValidate', ['goods_id'=>$goods_id,'goods_name'=>$goods_name,'goods_price'=>$goods_price,'goods_time'=>$goods_time,'goods_category_id'=>$goods_category_id,'goods_shop_id'=>$goods_shop_id,'goods_status'=>$goods_status], 'update');
  59. $result = RaiseOldGoodsServer::updateGoods($goods_id, $goods_name, $goods_title, $goods_time, $goods_category_id, $goods_banner, $goods_label, $goods_status, $goods_service_population, $goods_service_consumables, $goods_service_qualifications, $goods_service_explain, $goods_service_standard, $goods_service_process, $goods_technological, $goods_tips, $goods_shop_id, $goods_price, $admin_id);
  60. return json_success($result, '修改成功');
  61. }
  62. /**
  63. * Notes:删除养老产品
  64. * @return \support\Response
  65. * User: ZQ
  66. * Date: 2022/10/31
  67. */
  68. public function delGoods()
  69. {
  70. $goods_id = $this->request->get('goods_id');
  71. $admin_id = $this->request->admin_id;
  72. $this->validateCheck('raise\RaiseOldGoodsValidate', ['goods_id' => $goods_id], 'info');
  73. $result = RaiseOldGoodsServer::delGoods($goods_id,$admin_id);
  74. if ($result){
  75. return json_success($result, '删除成功');
  76. }else{
  77. throw new \Exception('删除失败!');
  78. }
  79. }
  80. /**
  81. * Notes:添加养老产品
  82. * @return \support\Response
  83. * User: ZQ
  84. * Date: 2022/10/31
  85. */
  86. public function addGoods()
  87. {
  88. $goods_name = $this->request->post('goods_name');
  89. $goods_shop_id = $this->request->post('goods_shop_id');
  90. $goods_title = $this->request->post('goods_title','');
  91. $goods_banner = $this->request->post('goods_banner','');
  92. $goods_category_id = $this->request->post('goods_category_id');
  93. $goods_label = $this->request->post('goods_label','');
  94. $goods_price = $this->request->post('goods_price');
  95. $goods_status = $this->request->post('goods_status');
  96. $goods_time = $this->request->post('goods_time','');
  97. $goods_service_population = $this->request->post('goods_service_population','');
  98. $goods_service_consumables = $this->request->post('goods_service_consumables','');
  99. $goods_service_qualifications = $this->request->post('goods_service_qualifications','');
  100. $goods_service_explain = $this->request->post('goods_service_explain','');
  101. $goods_service_standard = $this->request->post('goods_service_standard','');
  102. $goods_service_process = $this->request->post('goods_service_process','');
  103. $goods_technological = $this->request->post('goods_technological','');
  104. $goods_tips = $this->request->post('goods_tips','');
  105. $admin_id = $this->request->admin_id;
  106. $this->validateCheck('raise\RaiseOldGoodsValidate', ['goods_name'=>$goods_name,'goods_price'=>$goods_price,'goods_time'=>$goods_time,'goods_category_id'=>$goods_category_id,'goods_shop_id'=>$goods_shop_id,'goods_status'=>$goods_status], 'create');
  107. $result = RaiseOldGoodsServer::insertGoods($goods_name, $goods_title, $goods_time, $goods_category_id, $goods_banner, $goods_label, $goods_status, $goods_service_population, $goods_service_consumables, $goods_service_qualifications, $goods_service_explain, $goods_service_standard, $goods_service_process, $goods_technological, $goods_tips, $goods_shop_id, $goods_price, $admin_id);
  108. return json_success($result, '添加成功');
  109. }
  110. /**
  111. * Notes:查询养老产品详情
  112. * @return \support\Response
  113. * User: ZQ
  114. * Date: 2022/10/31
  115. */
  116. public function goodsInfo()
  117. {
  118. $goods_id = $this->request->get('goods_id');
  119. $this->validateCheck('raise\RaiseOldGoodsValidate', ['goods_id' => $goods_id], 'info');
  120. $result = RaiseOldGoodsServer::goodsInfo($goods_id);
  121. return json_success($result, '成功');
  122. }
  123. /**
  124. * Notes:养老产品上架下架
  125. * @return \support\Response
  126. * User: ZQ
  127. * Date: 2022/10/09
  128. */
  129. public function updateStatus()
  130. {
  131. $goods_id = $this->request->get('goods_id');
  132. $goods_status = $this->request->get('goods_status');
  133. $this->validateCheck('raise\RaiseOldGoodsValidate', ['goods_id' => $goods_id], 'info');
  134. $result = RaiseOldGoodsServer::updateStatus($goods_id, $goods_status);
  135. return json_success($result, '修改成功');
  136. }
  137. }