Kernel.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. namespace App\Console;
  3. use App\Console\Commands\Apollo;
  4. use App\Console\Commands\Downloads;
  5. use App\Console\Commands\PostStatistics;
  6. use App\Console\Commands\PostYesterday;
  7. use Illuminate\Console\Scheduling\Schedule;
  8. use Laravel\Lumen\Console\Kernel as ConsoleKernel;
  9. class Kernel extends ConsoleKernel
  10. {
  11. /**
  12. * The Artisan commands provided by your application.
  13. *
  14. * @var array
  15. */
  16. protected $commands = [
  17. Apollo::class,
  18. PostYesterday::class,
  19. Downloads::class,
  20. PostStatistics::class
  21. ];
  22. /**
  23. * Define the application's command schedule.
  24. *
  25. * @param \Illuminate\Console\Scheduling\Schedule $schedule
  26. * @return void
  27. */
  28. protected function schedule(Schedule $schedule)
  29. {
  30. $path = storage_path('logs/'.date('Y-m-d').'-schedule.log');
  31. $schedule->command('download:download')
  32. ->everyMinute()
  33. ->withoutOverlapping()->appendOutputTo($path);
  34. $schedule->command('post:yesterday')
  35. ->dailyAt('00:10')
  36. ->withoutOverlapping()->appendOutputTo($path);
  37. $schedule->command('post:statistics')
  38. ->dailyAt('00:20')
  39. ->withoutOverlapping()->appendOutputTo($path);
  40. }
  41. }