CouponController.php 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  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\marketing;
  20. use app\adminapi\controller\BaseAdminController;
  21. use app\adminapi\lists\marketing\CouponCommenLists;
  22. use app\adminapi\lists\marketing\CouponLists;
  23. use app\adminapi\lists\marketing\CouponRecordLists;
  24. use app\adminapi\logic\marketing\CouponLogic;
  25. use app\adminapi\validate\marketing\CouponValidate;
  26. use think\response\Json;
  27. /**
  28. * 优惠券控制器
  29. * Class CouponController
  30. * @package app\adminapi\controller\marketing
  31. */
  32. class CouponController extends BaseAdminController
  33. {
  34. /**
  35. * @notes 优惠券公共接口
  36. * @return Json
  37. * @author cjhao
  38. * @date 2021/9/7 17:46
  39. */
  40. public function commonLists()
  41. {
  42. return $this->dataLists(new CouponCommenLists());
  43. }
  44. /**
  45. * @notes 优惠券列表
  46. * @return Json
  47. * @author 张无忌
  48. * @date 2021/7/21 15:45
  49. */
  50. public function lists()
  51. {
  52. return $this->dataLists(new CouponLists());
  53. }
  54. /**
  55. * @notes 获取优惠券详细
  56. * @return Json
  57. * @author 张无忌
  58. * @date 2021/7/20 16:28
  59. */
  60. public function detail()
  61. {
  62. $params = (new CouponValidate())->goCheck('detail');
  63. $detail = CouponLogic::detail($params);
  64. return $this->success('获取成功', $detail);
  65. }
  66. /**
  67. * @notes 添加优惠券
  68. * @return Json
  69. * @author 张无忌
  70. * @date 2021/7/20 14:40
  71. */
  72. public function add()
  73. {
  74. $params = (new CouponValidate())->post()->goCheck('add');
  75. CouponLogic::add($params);
  76. return $this->success('添加成功', [], 1, 1);
  77. }
  78. /**
  79. * @notes 编辑优惠券
  80. * @return Json
  81. * @author 张无忌
  82. * @date 2021/7/20 14:59
  83. */
  84. public function edit()
  85. {
  86. $params = (new CouponValidate())->post()->goCheck('edit');
  87. $result = CouponLogic::edit($params);
  88. if ($result === true) {
  89. return $this->success('编辑成功', [], 1, 1);
  90. }
  91. return $this->fail($result);
  92. }
  93. /**
  94. * @notes 删除优惠券
  95. * @return Json
  96. * @author 张无忌
  97. * @date 2021/7/20 15:45
  98. */
  99. public function delete()
  100. {
  101. $params = (new CouponValidate())->post()->goCheck('delete');
  102. $result = CouponLogic::delete($params);
  103. if ($result === true) {
  104. return $this->success('删除成功', [], 1, 1);
  105. }
  106. return $this->fail($result);
  107. }
  108. /**
  109. * @notes 优惠券基本信息
  110. * @author 张无忌
  111. * @date 2021/7/20 18:41
  112. */
  113. public function info()
  114. {
  115. $params = (new CouponValidate())->goCheck('detail');
  116. $result = CouponLogic::info($params);
  117. return $this->success('获取成功', $result);
  118. }
  119. /**
  120. * @notes 开启发放优惠券
  121. * @author 张无忌
  122. * @date 2021/7/20 18:39
  123. */
  124. public function open()
  125. {
  126. $params = (new CouponValidate())->post()->goCheck('detail');
  127. CouponLogic::open($params);
  128. return $this->success('开启成功', [], 1, 1);
  129. }
  130. /**
  131. * @notes 结束发放优惠券
  132. * @author 张无忌
  133. * @date 2021/7/20 18:39
  134. */
  135. public function stop()
  136. {
  137. $params = (new CouponValidate())->post()->goCheck('detail');
  138. CouponLogic::stop($params);
  139. return $this->success('结束成功', [], 1, 1);
  140. }
  141. /**
  142. * @notes 卖家发放优惠券
  143. * @author 张无忌
  144. * @date 2021/7/20 18:40
  145. */
  146. public function send()
  147. {
  148. $params = (new CouponValidate())->post()->goCheck('send');
  149. $result = CouponLogic::send($params);
  150. if ($result === true) {
  151. return $this->success('发放成功', [], 1, 1);
  152. }
  153. return $this->fail($result);
  154. }
  155. /**
  156. * @notes 领取记录
  157. * @author 张无忌
  158. * @date 2021/7/21 16:46
  159. */
  160. public function record()
  161. {
  162. return $this->dataLists(new CouponRecordLists());
  163. }
  164. /**
  165. * @notes 作废
  166. * @author 张无忌
  167. * @date 2021/7/21 17:12
  168. */
  169. public function void()
  170. {
  171. $params = (new CouponValidate())->post()->goCheck('void');
  172. CouponLogic::void($params);
  173. return $this->success('作废成功', [], 1, 1);
  174. }
  175. }