Kernel.php 2.7 KB

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