LuckyDrawController.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <?php
  2. namespace app\adminapi\controller\lucky_draw;
  3. use app\adminapi\controller\BaseAdminController;
  4. use app\adminapi\lists\lucky_draw\LuckyDrawList;
  5. use app\adminapi\lists\lucky_draw\LuckyDrawRecordList;
  6. use app\adminapi\logic\lucky_draw\LuckyDrawLogic;
  7. use app\adminapi\validate\lucky_draw\LuckyDrawValidate;
  8. use app\common\service\JsonService;
  9. /**
  10. * 幸运抽奖
  11. */
  12. class LuckyDrawController extends BaseAdminController
  13. {
  14. /**
  15. * @notes 获取奖品类型
  16. * @return \think\response\Json
  17. * @author Tab
  18. * @date 2021/11/24 9:49
  19. */
  20. public function getPrizeType()
  21. {
  22. $result = LuckyDrawLogic::getPrizeType();
  23. return JsonService::data($result);
  24. }
  25. /**
  26. * @notes 添加幸运抽奖活动
  27. * @author Tab
  28. * @date 2021/11/24 10:20
  29. */
  30. public function add()
  31. {
  32. $params = (new LuckyDrawValidate())->post()->goCheck('add');
  33. $result = LuckyDrawLogic::add($params);
  34. if ($result) {
  35. return JsonService::success('添加成功');
  36. }
  37. return JsonService::fail(LuckyDrawLogic::getError());
  38. }
  39. /**
  40. * @notes 查看幸运抽奖活动详情
  41. * @return \think\response\Json
  42. * @author Tab
  43. * @date 2021/11/24 14:04
  44. */
  45. public function detail()
  46. {
  47. $params = (new LuckyDrawValidate())->goCheck('detail');
  48. $result = LuckyDrawLogic::detail($params);
  49. return JsonService::data($result);
  50. }
  51. /**
  52. * @notes 编辑幸运抽奖活动
  53. * @return \think\response\Json
  54. * @author Tab
  55. * @date 2021/11/24 14:19
  56. */
  57. public function edit()
  58. {
  59. $params = (new LuckyDrawValidate())->post()->goCheck('edit');
  60. $result = LuckyDrawLogic::edit($params);
  61. if ($result) {
  62. return JsonService::success('编辑成功');
  63. }
  64. return JsonService::fail(LuckyDrawLogic::getError());
  65. }
  66. /**
  67. * @notes 开始活动
  68. * @author Tab
  69. * @date 2021/11/24 14:58
  70. */
  71. public function start()
  72. {
  73. $params = (new LuckyDrawValidate())->post()->goCheck('start');
  74. $result = LuckyDrawLogic::start($params);
  75. if ($result) {
  76. return JsonService::success('操作成功');
  77. }
  78. return JsonService::fail(LuckyDrawLogic::getError());
  79. }
  80. /**
  81. * @notes 结束活动
  82. * @return \think\response\Json
  83. * @author Tab
  84. * @date 2021/11/24 15:04
  85. */
  86. public function end()
  87. {
  88. $params = (new LuckyDrawValidate())->post()->goCheck('end');
  89. $result = LuckyDrawLogic::end($params);
  90. if ($result) {
  91. return JsonService::success('操作成功');
  92. }
  93. return JsonService::fail(LuckyDrawLogic::getError());
  94. }
  95. /**
  96. * @notes 删除幸运抽奖活动
  97. * @return \think\response\Json
  98. * @author Tab
  99. * @date 2021/11/24 15:13
  100. */
  101. public function delete()
  102. {
  103. $params = (new LuckyDrawValidate())->post()->goCheck('delete');
  104. $result = LuckyDrawLogic::delete($params);
  105. if ($result) {
  106. return JsonService::success('删除成功');
  107. }
  108. return JsonService::fail(LuckyDrawLogic::getError());
  109. }
  110. /**
  111. * @notes 幸运抽奖活动列表
  112. * @author Tab
  113. * @date 2021/11/24 15:19
  114. */
  115. public function lists()
  116. {
  117. return JsonService::dataLists(new LuckyDrawList());
  118. }
  119. /**
  120. * @notes 幸运抽奖记录
  121. * @author Tab
  122. * @date 2021/11/25 16:08
  123. */
  124. public function record()
  125. {
  126. $params = (new LuckyDrawValidate())->goCheck('record');
  127. return JsonService::dataLists(new LuckyDrawRecordList());
  128. }
  129. }