SeckillController.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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\SeckillLists;
  22. use app\adminapi\logic\marketing\SeckillLogic;
  23. use app\adminapi\validate\marketing\SeckillValidate;
  24. class SeckillController extends BaseAdminController
  25. {
  26. /**
  27. * @notes 秒杀活动列表
  28. * @author 张无忌
  29. * @date 2021/7/23 16:56
  30. */
  31. public function lists()
  32. {
  33. return $this->dataLists(new SeckillLists());
  34. }
  35. /**
  36. * @notes 秒杀概况
  37. * @author 张无忌
  38. * @date 2021/7/26 16:44
  39. */
  40. public function survey()
  41. {
  42. $result = SeckillLogic::survey();
  43. return $this->success('获取成功', $result);
  44. }
  45. /**
  46. * @notes 秒杀详细信息
  47. * @author 张无忌
  48. * @date 2021/7/23 17:00
  49. */
  50. public function detail()
  51. {
  52. $params = (new SeckillValidate())->goCheck('id');
  53. $result = SeckillLogic::detail($params);
  54. return $this->success('获取成功', $result);
  55. }
  56. /**
  57. * @notes 秒杀数据信息
  58. * @author 张无忌
  59. * @date 2021/7/23 17:00
  60. */
  61. public function info()
  62. {
  63. $params = (new SeckillValidate())->goCheck('id');
  64. $result = SeckillLogic::info($params);
  65. return $this->success('获取成功', $result, 1, 1);
  66. }
  67. /**
  68. * @notes 添加秒杀活动
  69. * @author 张无忌
  70. * @date 2021/7/23 16:57
  71. */
  72. public function add()
  73. {
  74. $params = (new SeckillValidate())->post()->goCheck('add');
  75. $result = SeckillLogic::add($params);
  76. if ($result === true) {
  77. return $this->success('添加成功', [],1, 1);
  78. }
  79. return $this->fail($result);
  80. }
  81. /**
  82. * @notes 编辑秒杀活动
  83. * @author 张无忌
  84. * @date 2021/7/23 16:57
  85. */
  86. public function edit()
  87. {
  88. $params = (new SeckillValidate())->post()->goCheck('edit');
  89. $result = SeckillLogic::edit($params);
  90. if ($result === true) {
  91. return $this->success('编辑成功', [],1, 1);
  92. }
  93. return $this->fail($result);
  94. }
  95. /**
  96. * @notes 删除秒杀活动
  97. * @author 张无忌
  98. * @date 2021/7/23 16:57
  99. */
  100. public function delete()
  101. {
  102. $params = (new SeckillValidate())->post()->goCheck('id');
  103. $result = SeckillLogic::delete($params);
  104. if ($result === true) {
  105. return $this->success('删除成功', [], 1, 1);
  106. }
  107. return $this->fail($result);
  108. }
  109. /**
  110. * @notes 确认开启活动
  111. * @param $params
  112. * @return \think\response\Json
  113. * @author 张无忌
  114. * @date 2021/7/23 16:57
  115. */
  116. public function open($params)
  117. {
  118. $result = SeckillLogic::open($params);
  119. if ($result === true) {
  120. return $this->success('确认成功', [], 1, 1);
  121. }
  122. return $this->fail($result);
  123. }
  124. /**
  125. * @notes 停止关闭活动
  126. * @param $params
  127. * @return \think\response\Json
  128. * @author 张无忌
  129. * @date 2021/7/23 16:58
  130. */
  131. public function stop($params)
  132. {
  133. $result = SeckillLogic::stop($params);
  134. if ($result === true) {
  135. return $this->success('结束成功', [],1, 1);
  136. }
  137. return $this->fail($result);
  138. }
  139. }