GroupActivityCategoryController.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | likeadmin快速开发前后端分离管理后台(PHP版)
  4. // +----------------------------------------------------------------------
  5. // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
  6. // | 开源版本可自由商用,可去除界面版权logo
  7. // | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
  8. // | github下载:https://github.com/likeshop-github/likeadmin
  9. // | 访问官网:https://www.likeadmin.cn
  10. // | likeadmin团队 版权所有 拥有最终解释权
  11. // +----------------------------------------------------------------------
  12. // | author: likeadminTeam
  13. // +----------------------------------------------------------------------
  14. namespace app\adminapi\controller\group_activity;
  15. use app\adminapi\controller\BaseAdminController;
  16. use app\adminapi\lists\group_activity\GroupActivityCategoryLists;
  17. use app\adminapi\logic\group_activity\GroupActivityCategoryLogic;
  18. use app\adminapi\validate\group_activity\GroupActivityCategoryValidate;
  19. /**
  20. * 拼团活动分类控制器
  21. * Class GroupActivityCategoryController
  22. * @package app\adminapi\controller\group_activity
  23. */
  24. class GroupActivityCategoryController extends BaseAdminController
  25. {
  26. /**
  27. * @notes 获取列表
  28. * @return \think\response\Json
  29. * @author likeadmin
  30. * @date 2025/03/13 10:31
  31. */
  32. public function lists()
  33. {
  34. return $this->dataLists(new GroupActivityCategoryLists());
  35. }
  36. /**
  37. * @notes 添加
  38. * @return \think\response\Json
  39. * @author likeadmin
  40. * @date 2025/03/13 10:31
  41. */
  42. public function add()
  43. {
  44. $params = (new GroupActivityCategoryValidate())->post()->goCheck('add');
  45. $result = GroupActivityCategoryLogic::add($params);
  46. if (true === $result) {
  47. return $this->success('添加成功', [], 1, 1);
  48. }
  49. return $this->fail(GroupActivityCategoryLogic::getError());
  50. }
  51. /**
  52. * @notes 编辑
  53. * @return \think\response\Json
  54. * @author likeadmin
  55. * @date 2025/03/13 10:31
  56. */
  57. public function edit()
  58. {
  59. $params = (new GroupActivityCategoryValidate())->post()->goCheck('edit');
  60. $result = GroupActivityCategoryLogic::edit($params);
  61. if (true === $result) {
  62. return $this->success('编辑成功', [], 1, 1);
  63. }
  64. return $this->fail(GroupActivityCategoryLogic::getError());
  65. }
  66. /**
  67. * @notes 删除
  68. * @return \think\response\Json
  69. * @author likeadmin
  70. * @date 2025/03/13 10:31
  71. */
  72. public function delete()
  73. {
  74. $params = (new GroupActivityCategoryValidate())->post()->goCheck('delete');
  75. GroupActivityCategoryLogic::delete($params);
  76. return $this->success('删除成功', [], 1, 1);
  77. }
  78. /**
  79. * @notes 获取详情
  80. * @return \think\response\Json
  81. * @author likeadmin
  82. * @date 2025/03/13 10:31
  83. */
  84. public function detail()
  85. {
  86. $params = (new GroupActivityCategoryValidate())->goCheck('detail');
  87. $result = GroupActivityCategoryLogic::detail($params);
  88. return $this->data($result);
  89. }
  90. /**
  91. * 获取活动分类二维码
  92. */
  93. public function getQRCode()
  94. {
  95. $params = (new GroupActivityCategoryValidate())->post()->goCheck('detail');
  96. return $this->success('',['qrcode'=>GroupActivityCategoryLogic::getQRCode($params, $this->request->domain())], 1, 1);
  97. }
  98. /**
  99. * 分类活动统计
  100. */
  101. public function total()
  102. {
  103. $id = (int)$this->request->param('id');
  104. $result = GroupActivityCategoryValidate::total($id);
  105. return $this->data($result);
  106. }
  107. /**
  108. * @notes 复制活动分类
  109. * @return \think\response\Json
  110. * @author likeadmin
  111. * @date 2025/03/13 10:31
  112. */
  113. public function copy()
  114. {
  115. $params = (new GroupActivityCategoryValidate())->goCheck('detail');
  116. $result = GroupActivityCategoryLogic::copy($params);
  117. if (true === $result) {
  118. return $this->success('复制成功', [], 1, 1);
  119. }
  120. return $this->fail(GroupActivityCategoryLogic::getError());
  121. }
  122. }