Plantask.php 993 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace app\index\controller;
  3. use think\Controller;
  4. use think\Db;
  5. use think\Cache;
  6. class Plantask extends Controller
  7. {
  8. //定时跑用户活跃,改成离线
  9. public function auto_user_active(){
  10. $actitime = time() - 300;
  11. $sql = 'update `mt_user` set is_active = 0 where is_active = 1 and id in (select user_id from mt_user_active where requesttime < '.$actitime.')';
  12. db()->query($sql);
  13. }
  14. //vip过期的,三个隐私设置改成0
  15. //vip过期的,更新用户表is_vip
  16. public function auto_vipend(){
  17. // $sql = 'update `mt_user_power` set yinsi = 0,yinshen = 0,wuhen = 0 where user_id in (select user_id from mt_user_wallet where vip_endtime > 0 and vip_endtime < '.time().')';
  18. // db()->query($sql);
  19. /*$sql2 = 'update `mt_user` set is_vip = 0 where is_vip = 1 and user_id in (select user_id from mt_user_wallet where vip_endtime > 0 and vip_endtime < '.time().')';
  20. db()->query($sql2);*/
  21. }
  22. }