Kernel.php 2.5 KB

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