Sina.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <?php
  2. namespace app\admin\controller;
  3. use think\admin\Controller;
  4. use think\admin\service\SystemService;
  5. use think\facade\Cache;
  6. use think\facade\Db;
  7. use think\facade\Request;
  8. class Sina extends Controller
  9. {
  10. /**
  11. * 修改聚合页配置
  12. * @auth true
  13. * @menu true
  14. * @throws \think\db\exception\DataNotFoundException
  15. * @throws \think\db\exception\DbException
  16. * @throws \think\db\exception\ModelNotFoundException
  17. */
  18. public function groupPageConfig()
  19. {
  20. $this->_applyFormToken();
  21. if ($this->request->isGet()) {
  22. $this->title = '修改聚合页配置';
  23. $this->config = SystemService::instance()->getData("group:page:config");
  24. $this->fetch();
  25. } else {
  26. SystemService::instance()->setData('group:page:config', Request::post("config"));
  27. sysoplog('聚合页配置管理', "修改聚合页配置成功");
  28. $this->success('修改聚合页配置成功!');
  29. }
  30. }
  31. /**
  32. * 修改品牌任务配置
  33. * @auth true
  34. * @menu true
  35. * @throws \think\db\exception\DataNotFoundException
  36. * @throws \think\db\exception\DbException
  37. * @throws \think\db\exception\ModelNotFoundException
  38. */
  39. public function brandTaskConfig()
  40. {
  41. $this->_applyFormToken();
  42. if ($this->request->isGet()) {
  43. $this->title = '修改品牌任务配置';
  44. $this->config = SystemService::instance()->getData("brand:task:config");
  45. $this->fetch();
  46. } else {
  47. SystemService::instance()->setData('brand:task:config', Request::post("config"));
  48. sysoplog('品牌任务配置管理', "修改品牌任务配置成功");
  49. $this->success('修改品牌任务配置成功!');
  50. }
  51. }
  52. /**
  53. * 修改活动规则
  54. * @auth true
  55. * @menu true
  56. * @throws \think\db\exception\DataNotFoundException
  57. * @throws \think\db\exception\DbException
  58. * @throws \think\db\exception\ModelNotFoundException
  59. */
  60. public function rule()
  61. {
  62. $this->_applyFormToken();
  63. if ($this->request->isGet()) {
  64. $this->title = '修改活动规则配置';
  65. $this->config = SystemService::instance()->getData("activity:rule");
  66. $this->fetch();
  67. } else {
  68. SystemService::instance()->setData('activity:rule', Request::post("config"));
  69. sysoplog('品牌活动规则管理', "修改活动规则配置成功");
  70. $this->success('修改活动规则配置成功!');
  71. }
  72. }
  73. public function removeUserTask()
  74. {
  75. $this->_applyFormToken();
  76. if ($this->request->isGet()) {
  77. $this->title = '清除用户任务数据';
  78. $this->fetch();
  79. } else {
  80. $uid = Request::post('uid');
  81. $dateForRedis = date('Ymd');
  82. $redisKey = "t:{$dateForRedis}:" . $uid;
  83. Cache::delete($redisKey);
  84. Cache::delete('u:f:' . $uid);
  85. Db::table('awards_user_task')->where('uid', $uid)->where('date', date('Y-m-d'))->delete();
  86. sysoplog('测试管理', "清除用户任务数据");
  87. $this->success('清除用户任务数据成功!');
  88. }
  89. }
  90. }