Kernel.php 2.1 KB

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