Kernel.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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 App\Console\Commands\VirusAdd;
  8. use Illuminate\Console\Scheduling\Schedule;
  9. use Laravel\Lumen\Console\Kernel as ConsoleKernel;
  10. class Kernel extends ConsoleKernel
  11. {
  12. /**
  13. * The Artisan commands provided by your application.
  14. *
  15. * @var array
  16. */
  17. protected $commands = [
  18. Apollo::class,
  19. PostYesterday::class,
  20. Downloads::class,
  21. VirusAdd::class,
  22. PostStatistics::class
  23. ];
  24. /**
  25. * Define the application's command schedule.
  26. *
  27. * @param \Illuminate\Console\Scheduling\Schedule $schedule
  28. * @return void
  29. */
  30. protected function schedule(Schedule $schedule)
  31. {
  32. $path = storage_path('logs/'.date('Y-m-d').'-schedule.log');
  33. $schedule->command('download:download')
  34. ->everyMinute()
  35. ->withoutOverlapping()->appendOutputTo($path);
  36. $schedule->command('post:yesterday')
  37. ->dailyAt('00:10')
  38. ->withoutOverlapping()->appendOutputTo($path);
  39. $schedule->command('post:statistics')
  40. ->dailyAt('00:20')
  41. ->withoutOverlapping()->appendOutputTo($path);
  42. //统计前一天用户行为累加
  43. $schedule->command('member:statistics')
  44. ->daily()
  45. ->withoutOverlapping()->appendOutputTo($path);
  46. }
  47. }