DiscountController.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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\logic\marketing\DiscountLogic;
  22. use app\adminapi\validate\marketing\DiscountValidate;
  23. /**
  24. * 会员折扣
  25. * Class DiscountController
  26. * @package app\adminapi\controller\marketing
  27. */
  28. class DiscountController extends BaseAdminController
  29. {
  30. /**
  31. * @notes 折扣列表
  32. * @return \think\response\Json
  33. * @author cjhao
  34. * @date 2022/5/5 12:04
  35. */
  36. public function lists()
  37. {
  38. return $this->dataLists();
  39. }
  40. /**
  41. * @notes 返回其他状态列表
  42. * @return \think\response\Json
  43. * @author cjhao
  44. * @date 2022/5/9 18:57
  45. */
  46. public function otherLists()
  47. {
  48. $otherLists = (new DiscountLogic())->otherLists();
  49. return $this->success('', $otherLists);
  50. }
  51. /**
  52. * @notes 参与折扣活动
  53. * @author cjhao
  54. * @date 2022/5/5 16:27
  55. */
  56. public function join()
  57. {
  58. $params = (new DiscountValidate())->post()->goCheck('join');
  59. (new DiscountLogic)->join($params);
  60. return $this->success('设置成功');
  61. }
  62. /**
  63. * @notes 退出折扣活动
  64. * @return \think\response\Json
  65. * @author cjhao
  66. * @date 2022/5/5 17:14
  67. */
  68. public function quit()
  69. {
  70. $params = (new DiscountValidate())->post()->goCheck('join');
  71. (new DiscountLogic)->quit($params);
  72. return $this->success('设置成功');
  73. }
  74. /**
  75. * @notes 获取折扣商品详情
  76. * @return \think\response\Json
  77. * @author cjhao
  78. * @date 2022/5/6 16:47
  79. */
  80. public function detail()
  81. {
  82. $params = (new DiscountValidate())->goCheck('detail');
  83. $detail = (new DiscountLogic())->detail($params);
  84. return $this->success('', $detail);
  85. }
  86. /**
  87. * @notes 设置会员价
  88. * @return \think\response\Json
  89. * @author cjhao
  90. * @date 2022/5/7 9:11
  91. */
  92. public function setDiscount()
  93. {
  94. $params = (new DiscountValidate())->post()->goCheck('setDiscount');
  95. $result = (new DiscountLogic())->setDiscount($params);
  96. if (true === $result) {
  97. return $this->success('设置成功',[],1,1);
  98. }
  99. return $this->fail($result);
  100. }
  101. }