<?php

namespace App\Console;

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 = [
        Commands\BookAdjust::class,
        Commands\BookAdjustOne::class,
        Commands\BookSpider::class,
        Commands\BookUpdate::class,
        Commands\BookUpdateOne::class,
        Commands\BookTest::class,
        Commands\BookAfterSpider::class,
        Commands\BookAttr::class,
        Commands\YqBook::class,
        Commands\channelCpcCode::class,
        Commands\updateFromNewYunqi::class,
        Commands\CheckOrderStatus::class,
    ];

    /**
     * Define the application's command schedule.
     *
     * @param  \Illuminate\Console\Scheduling\Schedule $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
        //$schedule->command('book:update')->dailyAt('06:00');

        //$schedule->command('book:update')->dailyAt('18:00');
        $schedule->command('book:update')->hourly()->when(function (){
            $now_hour = date('G');
            if($now_hour %4 ==0){
                return true;
            }
            return false;
        });

        //$schedule->command('checkOrderStatus')->everyMinute();
    }
}
