BargainActivityController.php 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | likeshop100%开源免费商用商城系统
  4. // +----------------------------------------------------------------------
  5. // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
  6. // | 开源版本可自由商用,可去除界面版权logo
  7. // | 商业版本务必购买商业授权,以免引起法律纠纷
  8. // | 禁止对系统程序代码以任何目的,任何形式的再发布
  9. // | gitee下载:https://gitee.com/likeshop_gitee
  10. // | github下载:https://github.com/likeshop-github
  11. // | 访问官网:https://www.likeshop.cn
  12. // | 访问社区:https://home.likeshop.cn
  13. // | 访问手册:http://doc.likeshop.cn
  14. // | 微信公众号:likeshop技术社区
  15. // | likeshop团队 版权所有 拥有最终解释权
  16. // +----------------------------------------------------------------------
  17. // | author: likeshopTeam
  18. // +----------------------------------------------------------------------
  19. namespace app\adminapi\controller\bargain;
  20. use app\adminapi\controller\BaseAdminController;
  21. use app\adminapi\lists\bargain\ActivityRecordList;
  22. use app\adminapi\lists\bargain\GoodsLists;
  23. use app\adminapi\logic\bargain\BargainActivityLogic;
  24. use app\adminapi\validate\bargain\BargainActivityValidate;
  25. use think\Validate;
  26. /**
  27. * 砍价活动控制器
  28. * Class BargainActivityController
  29. * @package app\adminapi\controller\bargain
  30. */
  31. class BargainActivityController extends BaseAdminController
  32. {
  33. /**
  34. * @notes 选择商品
  35. * @return \think\response\Json
  36. * @author Tab
  37. * @date 2021/8/26 15:59
  38. */
  39. public function chooseGoods()
  40. {
  41. $params = (new BargainActivityValidate())->post()->goCheck('chooseGoods');
  42. $result = BargainActivityLogic::chooseGoods($params);
  43. return $this->data($result);
  44. }
  45. /**
  46. * @notes 添加砍价活动
  47. * @return \think\response\Json
  48. * @author Tab
  49. * @date 2021/8/27 10:49
  50. */
  51. public function add()
  52. {
  53. $params = (new BargainActivityValidate())->post()->goCheck('add');
  54. $result = BargainActivityLogic::add($params);
  55. if ($result) {
  56. return $this->success('添加成功', [], 1, 1);
  57. }
  58. return $this->fail(BargainActivityLogic::getError());
  59. }
  60. /**
  61. * @notes 查看砍价活动详情
  62. * @return \think\response\Json
  63. * @author Tab
  64. * @date 2021/8/27 11:56
  65. */
  66. public function detail()
  67. {
  68. $params = (new BargainActivityValidate())->goCheck('detail');
  69. $result = BargainActivityLogic::detail($params);
  70. return $this->data($result);
  71. }
  72. /**
  73. * @notes 编辑砍价活动
  74. * @return \think\response\Json
  75. * @author Tab
  76. * @date 2021/8/27 15:07
  77. */
  78. public function edit()
  79. {
  80. $params = (new BargainActivityValidate())->post()->goCheck('edit');
  81. $result = BargainActivityLogic::edit($params);
  82. if ($result) {
  83. return $this->success('编辑成功', [], 1, 1);
  84. }
  85. return $this->fail(BargainActivityLogic::getError());
  86. }
  87. /**
  88. * @notes 确认砍价活动
  89. * @return \think\response\Json
  90. * @author Tab
  91. * @date 2021/8/27 17:08
  92. */
  93. public function confirm()
  94. {
  95. $params = (new BargainActivityValidate())->post()->goCheck('confirm');
  96. $result = BargainActivityLogic::confirm($params);
  97. if ($result) {
  98. return $this->success('确认成功', [], 1, 1);
  99. }
  100. return $this->fail(BargainActivityLogic::getError());
  101. }
  102. /**
  103. * @notes 结束砍价活动
  104. * @return \think\response\Json
  105. * @author Tab
  106. * @date 2021/8/27 17:27
  107. */
  108. public function stop()
  109. {
  110. $params = (new BargainActivityValidate())->post()->goCheck('stop');
  111. $result = BargainActivityLogic::stop($params);
  112. if ($result) {
  113. return $this->success('结束成功', [], 1, 1);
  114. }
  115. return $this->fail(BargainActivityLogic::getError());
  116. }
  117. /**
  118. * @notes 删除砍价活动
  119. * @return \think\response\Json
  120. * @author Tab
  121. * @date 2021/8/27 17:34
  122. */
  123. public function delete()
  124. {
  125. $params = (new BargainActivityValidate())->post()->goCheck('delete');
  126. $result = BargainActivityLogic::delete($params);
  127. if ($result) {
  128. return $this->success('删除成功', [], 1, 1);
  129. }
  130. return $this->fail(BargainActivityLogic::getError());
  131. }
  132. /**
  133. * @notes 砍价活动列表
  134. * @return \think\response\Json
  135. * @author Tab
  136. * @date 2021/8/27 17:49
  137. */
  138. public function lists()
  139. {
  140. return $this->dataLists();
  141. }
  142. /**
  143. * @notes 活动数据
  144. * @return \think\response\Json
  145. * @author Tab
  146. * @date 2021/9/23 18:53
  147. */
  148. public function activityData()
  149. {
  150. $params = (new BargainActivityValidate())->goCheck('activityData');
  151. $result = BargainActivityLogic::activityData($params);
  152. return $this->data($result);
  153. }
  154. /**
  155. * @notes 活动记录
  156. * @return \think\response\Json
  157. * @author Tab
  158. * @date 2021/9/24 15:33
  159. */
  160. public function activityRecord()
  161. {
  162. // (new BargainActivityValidate())->goCheck('activityRecord');
  163. return $this->dataLists(new ActivityRecordList());
  164. }
  165. /**
  166. * @notes 结束砍价
  167. * @return \think\response\Json
  168. * @author Tab
  169. * @date 2021/9/24 18:13
  170. */
  171. public function stopInitiate()
  172. {
  173. $params = (new BargainActivityValidate())->post()->goCheck('stopInitiate');
  174. $result = BargainActivityLogic::stopInitiate($params);
  175. if ($result) {
  176. return $this->success('结束砍价成功', [], 1, 1);
  177. }
  178. return $this->fail(BargainActivityLogic::getError());
  179. }
  180. /**
  181. * @notes 数据中心
  182. * @author Tab
  183. * @date 2021/9/24 18:24
  184. */
  185. public function dataCenter()
  186. {
  187. $result = BargainActivityLogic::dataCenter();
  188. return $this->data($result);
  189. }
  190. }