<?php

namespace App\Console\Commands;

use App\Models\UserVipLimit;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Log;

class ClearLimit extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'chenglu:clear_limit';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = '每天凌晨清空用户限制数据';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return int
     */
    public function handle()
    {
        /*
		 * 每天初始化用户限制数据
		 * */
        Log::info("清空用户限制数据准备执行，执行时间：".date('Y-m-d H:i:s'));
        UserVipLimit::query()->update(['weixin'=>0,'user'=>0,'dynamic'=>0,'user_detail'=>0,'user_info'=>0]);
        Log::info("用户限制数据已清空，执行时间：".date('Y-m-d H:i:s'));
    }
}
