<?php

namespace app\index\controller;

use think\Controller;
use think\Db;
use think\Cache;

class Plantask extends Controller
{



    //定时跑用户活跃,改成离线
    public function auto_user_active(){
        $actitime = time() - 300;

        $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.')';
        db()->query($sql);
    }

    //vip过期的,三个隐私设置改成0
    //vip过期的,更新用户表is_vip
    public function auto_vipend(){
//        $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().')';
//        db()->query($sql);

        /*$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().')';
        db()->query($sql2);*/
    }




}