<?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\Update\UpdateTrackArtistCommand; 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, UpdateTrackArtistCommand::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')->twiceDaily(11, 20); $schedule->command('zing:get-new-release-track')->dailyAt('13:00'); //$schedule->command('nct:get-track')->dailyAt('13:10'); $schedule->command('nhacvn:get-track')->dailyAt('13:20'); $schedule->command('keeng:get-track')->dailyAt('13:30'); $schedule->command('crawler:get-track-image')->dailyAt('13:40'); // Cập nhật thông tin ca sĩ, nhạc sĩ sau 21h $schedule->command('track:update-artist zing')->dailyAt('21:05'); $schedule->command('track:update-artist keeng')->dailyAt('21:10'); $schedule->command('track:update-artist nct')->dailyAt('21:15'); // 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'); // 22h20 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'); // 22h40 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('2:00'); $schedule->command('calculate:daily-listen')->dailyAt('2:10'); $schedule->command('calculate:report daily')->dailyAt('3:05'); $schedule->command('calculate:report weekly')->dailyAt('4:05'); $schedule->command('calculate:report monthly')->monthlyOn(21, '5:05'); $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'); } }