Kernel.php 2.0 KB

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