<?php

namespace App\Console;

use App\Console\Commands\ClearLimit;
use App\Console\Commands\VipOutTime;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
    /**
     * The Artisan commands provided by your application.
     *
     * @var array
     */
    protected $commands = [
        //
        ClearLimit::class, //用户限制
        VipOutTime::class, //VIP过期
    ];

    /**
     * Define the application's command schedule.
     *
     * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
        // $schedule->command('inspire')->hourly();

        //此处相当于规定同意的定时执行时间，如每天凌晨执行以下任务
        $schedule->command('chenglu:clear_limit')->daily()->description('每天凌晨自动清空用户限制');
        $schedule->command('chenglu:vip_out_time')->everyMinute()->description('每分钟检查用户会员是否过期');
    }

    /**
     * Register the commands for the application.
     *
     * @return void
     */
    protected function commands()
    {
        $this->load(__DIR__.'/Commands');

        require base_path('routes/console.php');
    }
}
