SignController.php 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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\sign;
  20. use app\adminapi\controller\BaseAdminController;
  21. use app\adminapi\logic\sign\SignLogic;
  22. use app\adminapi\validate\sign\SignValidate;
  23. /**
  24. * 签到控制器
  25. * Class SignController
  26. * @package app\adminapi\controller\sign
  27. */
  28. class SignController extends BaseAdminController
  29. {
  30. /**
  31. * @notes 获取签到设置
  32. * @return \think\response\Json
  33. * @author Tab
  34. * @date 2021/8/14 19:05
  35. */
  36. public function getConfig()
  37. {
  38. $result = SignLogic::getConfig();
  39. return $this->data($result);
  40. }
  41. /**
  42. * @notes 设置签到规则
  43. * @return \think\response\Json
  44. * @author Tab
  45. * @date 2021/8/16 9:53
  46. */
  47. public function setConfig()
  48. {
  49. $params = (new SignValidate())->post()->goCheck('setConfig');
  50. $result = SignLogic::setConfig($params);
  51. if($result) {
  52. return $this->success('保存成功', [], 1, 1);
  53. }
  54. return $this->fail(SignLogic::getError());
  55. }
  56. /**
  57. * @notes 添加连续签到规则
  58. * @return \think\response\Json
  59. * @author Tab
  60. * @date 2021/8/16 15:20
  61. */
  62. public function add()
  63. {
  64. $params = (new SignValidate())->post()->goCheck('add');
  65. $result = SignLogic::add($params);
  66. if($result) {
  67. return $this->success('添加成功', [], 1, 1);
  68. }
  69. return $this->fail(SignLogic::getError());
  70. }
  71. /**
  72. * @notes 编辑连续签到规则
  73. * @return \think\response\Json
  74. * @author Tab
  75. * @date 2021/8/16 15:42
  76. */
  77. public function edit()
  78. {
  79. $params = (new SignValidate())->post()->goCheck('edit');
  80. $result = SignLogic::edit($params);
  81. if($result) {
  82. return $this->success('编辑成功', [], 1, 1);
  83. }
  84. return $this->fail(SignLogic::getError());
  85. }
  86. /**
  87. * @notes 删除连续签到规则
  88. * @return \think\response\Json
  89. * @author Tab
  90. * @date 2021/8/16 15:49
  91. */
  92. public function delete()
  93. {
  94. $params = (new SignValidate())->post()->goCheck('delete');
  95. $result = SignLogic::delete($params);
  96. if($result) {
  97. return $this->success('删除成功', [], 1, 1);
  98. }
  99. return $this->fail(SignLogic::getError());
  100. }
  101. /**
  102. * @notes 查看连续签到规则详情
  103. * @return \think\response\Json
  104. * @author Tab
  105. * @date 2021/8/16 11:35
  106. */
  107. public function detail()
  108. {
  109. $params = (new SignValidate())->goCheck('detail');
  110. $result = SignLogic::detail($params);
  111. return $this->data($result);
  112. }
  113. /**
  114. * @notes 重置说明
  115. * @return \think\response\Json
  116. * @author Tab
  117. * @date 2021/8/16 19:21
  118. */
  119. public function resetRemark()
  120. {
  121. if(!$this->request->isPost()) {
  122. return $this->fail('请求方式错误');
  123. }
  124. SignLogic::resetRemark();
  125. return $this->success('重置成功', [], 1, 1);
  126. }
  127. /**
  128. * @notes 查看签到记录
  129. * @return \think\response\Json
  130. * @author Tab
  131. * @date 2021/8/16 19:30
  132. */
  133. public function lists()
  134. {
  135. return $this->dataLists();
  136. }
  137. /**
  138. * @notes 签到数据中心
  139. * @return \think\response\Json
  140. * @author Tab
  141. * @date 2021/8/16 19:53
  142. */
  143. public function dataCenter()
  144. {
  145. $result = SignLogic::dataCenter();
  146. return $this->data($result);
  147. }
  148. }