<?php namespace App\Console; use App\Console\Commands\CalculateDailyListenCommand; use App\Console\Commands\CalculateReportCommand; use App\Console\Commands\CrawlerTrackListenCommand; use App\Console\Commands\CrontjobCommand; use App\Console\Commands\Keeng\KeengCrawlerByCateCommand; use App\Console\Commands\Keeng\KeengCrawlerNewRealeaseCommand; use App\Console\Commands\Keeng\KeengCrawlerTrackCommand; use App\Console\Commands\Nct\NctCrawlerTrackCommand; use App\Console\Commands\NhacVn\NhacVnCrawlerTrackCommand; use App\Console\Commands\Zing\ZingCrawlerNewRealeaseCommand; use App\Console\Commands\Zing\ZingCrawlerTrackCommand; use App\Console\Commands\CrawlerTrackImageCommand; 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 = [ CrontjobCommand::class, ZingCrawlerTrackCommand::class, ZingCrawlerNewRealeaseCommand::class, NctCrawlerTrackCommand::class, NhacVnCrawlerTrackCommand::class, KeengCrawlerTrackCommand::class, KeengCrawlerByCateCommand::class, KeengCrawlerNewRealeaseCommand::class, CrawlerTrackImageCommand::class, CrawlerTrackListenCommand::class, CalculateDailyListenCommand::class, CalculateReportCommand::class, ]; /** * Define the application's command schedule. * * @param \Illuminate\Console\Scheduling\Schedule $schedule * @return void */ protected function schedule(Schedule $schedule) { //$schedule->command('crontjob:test')->hourly(); //$schedule->command('zing:get-track')->everyThirtyMinutes(); //$schedule->command('zing:get-new-release-track')->hourlyAt(5); //$schedule->command('nct:get-track')->hourlyAt(10); //$schedule->command('nhacvn:get-track')->hourlyAt(15); //$schedule->command('keeng:get-track')->hourlyAt(20); //$schedule->command('crawler:get-track-image')->hourlyAt(35); $schedule->command('zing:get-track')->twiceDaily(11, 20); $schedule->command('zing:get-new-release-track')->dailyAt('13:00'); $schedule->command('nct:get-track')->dailyAt('14:00'); $schedule->command('nhacvn:get-track')->dailyAt('15:00'); $schedule->command('keeng:get-track')->dailyAt('10:00'); $schedule->command('crawler:get-track-image')->dailyAt('21:00'); // 22h bắt đầu quét. Quét 3 lần, lần cuối quét hết $schedule->command('crawler:get-listen keeng')->dailyAt('22:00'); $schedule->command('crawler:get-listen keeng')->dailyAt('22:05'); $schedule->command('crawler:get-listen keeng --limit=-1')->dailyAt('22:10'); // 22h30 bắt đầu quét. Quét 3 lần, lần cuối quét hết $schedule->command('crawler:get-listen nct')->dailyAt('22:20'); $schedule->command('crawler:get-listen nct')->dailyAt('22:25'); $schedule->command('crawler:get-listen nct --limit=-1')->dailyAt('22:30'); // 23h bắt đầu quét. Quét 3 lần, lần cuối quét hết $schedule->command('crawler:get-listen zing')->dailyAt('22:40'); $schedule->command('crawler:get-listen zing')->dailyAt('22:45'); $schedule->command('crawler:get-listen zing --limit=-1')->dailyAt('22:50'); $schedule->command('calculate:daily-listen')->dailyAt('1:00'); $schedule->command('calculate:daily-listen')->dailyAt('1:10'); $schedule->command('php artisan calculate:report daily')->dailyAt('8:00'); $schedule->command('php artisan calculate:report weekly')->sundays(); $schedule->command('php artisan calculate:report monthly')->monthlyOn(21, '6:10'); $schedule->command('queue:work --once --timeout=120')->everyMinute()->withoutOverlapping(); } /** * Register the Closure based commands for the application. * * @return void */ protected function commands() { require base_path('routes/console.php'); } }