Shop.php 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <?php
  2. namespace app\admin\controller\medical;
  3. use app\admin\controller\BaseController;
  4. use app\admin\model\MerchantShop;
  5. use app\admin\server\medical\MedicalCarePostageServer;
  6. use app\admin\server\medical\MedicalCareProductServer;
  7. use app\admin\server\medical\ShopServer;
  8. use app\admin\server\package\PackageGoodsServer;
  9. class Shop extends BaseController
  10. {
  11. /**
  12. * Notes:店铺列表
  13. * @return \support\Response
  14. * User: QJF
  15. * Date: 2022/9/30
  16. */
  17. public function getShopList()
  18. {
  19. [$page, $limit] = $this->getPage();
  20. $keywords = $this->request->get('keywords');
  21. $result = ShopServer::getShopList($page, $limit,$keywords);
  22. return json_success($result, '成功');
  23. }
  24. /**
  25. * Notes:根据分类查询店铺列表
  26. * @return \support\Response
  27. * User: ZQ
  28. * Date: 2022/11/8
  29. */
  30. public function getCategoryShop()
  31. {
  32. $category_id = $this->request->get('shop_category_id');
  33. $result = ShopServer::getCategoryShop($category_id);
  34. return json_success($result, '成功');
  35. }
  36. /**
  37. * Notes:根据分类查询店铺列表
  38. * @return \support\Response
  39. * User: ZQ
  40. * Date: 2022/11/8
  41. */
  42. public function getCategorysShop()
  43. {
  44. $result = ShopServer::getCategorysShop();
  45. return json_success($result, '成功');
  46. }
  47. /**
  48. * Notes:健康模块店铺列表
  49. * @return \support\Response
  50. * User: QJF
  51. * Date: 2022/11/08
  52. */
  53. public function getHealthyShopList()
  54. {
  55. $result = ShopServer::getHealthyShopList();
  56. return json_success($result, '成功');
  57. }
  58. /**
  59. * Notes:添加运费模板
  60. * @return \support\Response
  61. * User: QJF
  62. * Date: 2022/9/28
  63. *
  64. */
  65. public function addShop()
  66. {
  67. $param = $this->request->post();
  68. $this->validateCheck('medical\ShopValidate',
  69. [
  70. 'shop_sort' => $param['shop_sort'],
  71. 'shop_category_id' => $param['shop_category_id'],
  72. 'shop_name' => $param['shop_name'],
  73. 'shop_logo' => $param['shop_logo'],
  74. 'shop_label' => $param['shop_label'],
  75. 'shop_business_hours' => $param['shop_business_hours'],
  76. 'shop_type' => $param['shop_type'],
  77. 'shop_address' => $param['shop_address'],
  78. 'shop_is_auto' => $param['shop_is_auto'],
  79. 'shop_lat' => $param['shop_lat'],
  80. 'shop_lng' => $param['shop_lng'],
  81. 'shop_phone' => $param['shop_phone'],
  82. 'shop_real_name' => $param['shop_real_name'],
  83. ],
  84. 'add');
  85. $result = ShopServer::insertShop($param);
  86. return json_success($result, '添加成功');
  87. }
  88. /**
  89. * Notes:修改店铺
  90. * @return \support\Response
  91. * User: QJF
  92. * Date: 2022/9/30
  93. */
  94. public function updateShop()
  95. {
  96. $param = $this->request->post();
  97. $this->validateCheck('medical\ShopValidate',
  98. [
  99. 'shop_sort' => $param['shop_sort'],
  100. 'shop_category_id' => $param['shop_category_id'],
  101. 'shop_id' => $param['shop_id'],
  102. 'shop_name' => $param['shop_name'],
  103. 'shop_logo' => $param['shop_logo'],
  104. 'shop_label' => $param['shop_label'],
  105. 'shop_business_hours' => $param['shop_business_hours'],
  106. 'shop_type' => $param['shop_type'],
  107. 'shop_address' => $param['shop_address'],
  108. 'shop_is_auto' => $param['shop_is_auto'],
  109. 'shop_lat' => $param['shop_lat'],
  110. 'shop_lng' => $param['shop_lng'],
  111. 'shop_phone' => $param['shop_phone'],
  112. 'shop_real_name' => $param['shop_real_name'],
  113. ], 'update');
  114. $result = ShopServer::updateShop($param);
  115. return json_success($result, '修改成功');
  116. }
  117. /**
  118. * Notes:删除权益包
  119. * @return \support\Response
  120. * User: QJF
  121. * Date: 2022/9/23
  122. */
  123. public function delShop()
  124. {
  125. $shop_id = $this->request->get('shop_id');
  126. $this->validateCheck('medical\ShopValidate', ['shop_id' => $shop_id], 'del');
  127. $result = ShopServer::delShop($shop_id);
  128. if ($result){
  129. return json_success($result, '删除成功');
  130. }else{
  131. throw new \Exception('删除失败!');
  132. }
  133. }
  134. /**
  135. * Notes:查看模板详情
  136. * @return \support\Response
  137. * User: QJF
  138. * Date: 2022/9/28
  139. */
  140. public function infoShop()
  141. {
  142. $shop_id = $this->request->get('shop_id');
  143. $this->validateCheck('medical\ShopValidate', ['shop_id' => $shop_id], 'info');
  144. $result = ShopServer::infoShop($shop_id);
  145. if ($result){
  146. return json_success($result, '获取成功');
  147. }else{
  148. throw new \Exception('获取失败!');
  149. }
  150. }
  151. //产品上下架
  152. public function showShop(){
  153. $shop_id = $this->request->get('shop_id');
  154. $shop_status= $this->request->get('shop_status');
  155. $this->validateCheck('medical\ShopValidate', ['shop_id' => $shop_id], 'del');
  156. $result = ShopServer::showShop($shop_id,$shop_status);
  157. if ($result){
  158. return json_success($result, '成功');
  159. }else{
  160. throw new \Exception('失败!');
  161. }
  162. }
  163. }