Kernel.php 1.6 KB

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