Plan.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. namespace app\api\controller;
  3. use app\api\model\UsersModel;
  4. use think\Controller;
  5. use think\Db;
  6. /**
  7. * 宝塔计划任务类
  8. * @ApiInternal
  9. * Class Plan
  10. * @package app\api\controller
  11. */
  12. class Plan extends Controller
  13. {
  14. // 每月清空VIP开通限制 /api/plan/clearVipData
  15. public function clearVipData()
  16. {
  17. $ids = UsersModel::field('user_id')->select();
  18. $ip = $this->request->ip();
  19. foreach ($ids as $v) {
  20. UsersModel::where('user_id', $v['user_id'])->update(['vip_use_num' => 0, 'vip_discount_quota' => 0]);
  21. }
  22. $info = array(
  23. 'desc' => '每月清空VIP开通限制',
  24. 'status' => '成功',
  25. 'ip' => $ip,
  26. 'time' => date('Y-m-d H:i:s' ,time())
  27. );
  28. Db::name('plan_log')->insert($info);
  29. }
  30. // 清空今日已用的基础排队次数 /api/plan/clearTodayQueueUseNum
  31. public function clearTodayQueueUseNum()
  32. {
  33. $ids = UsersModel::field('user_id')->select();
  34. $ip = $this->request->ip();
  35. foreach ($ids as $v) {
  36. UsersModel::where('user_id', $v['user_id'])->update(['queue_num_today' => 0]);
  37. }
  38. $info = array(
  39. 'desc' => '每天清空已用基础排队次数',
  40. 'status' => '成功',
  41. 'ip' => $ip,
  42. 'time' => date('Y-m-d H:i:s' ,time())
  43. );
  44. Db::name('plan_log')->insert($info);
  45. }
  46. }