Kernel.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. namespace App\Console;
  3. use App\Console\Commands\Apollo;
  4. use App\Console\Commands\BehaviorRecord;
  5. use App\Console\Commands\CalcPostWeight;
  6. use App\Console\Commands\ContentFeedCreate;
  7. use App\Console\Commands\ContentFeedDelete;
  8. use App\Console\Commands\ExcellentResidents;
  9. use App\Console\Commands\RankingList;
  10. use Illuminate\Console\Scheduling\Schedule;
  11. use Laravel\Lumen\Console\Kernel as ConsoleKernel;
  12. class Kernel extends ConsoleKernel
  13. {
  14. /**
  15. * The Artisan commands provided by your application.
  16. *
  17. * @var array
  18. */
  19. protected $commands = [
  20. Apollo::class,
  21. BehaviorRecord::class,
  22. CalcPostWeight::class,
  23. ContentFeedCreate::class,
  24. ContentFeedDelete::class,
  25. ExcellentResidents::class,
  26. RankingList::class
  27. ];
  28. /**
  29. * Define the application's command schedule.
  30. *
  31. * @param \Illuminate\Console\Scheduling\Schedule $schedule
  32. * @return void
  33. */
  34. protected function schedule(Schedule $schedule)
  35. {
  36. $path = storage_path('logs/' . date('Y-m-d') . '-schedule.log');
  37. $schedule->command('post:calc_weight')
  38. ->everyFifteenMinutes()->withoutOverlapping()->appendOutputTo($path);
  39. $schedule->command('excellent:residents')
  40. ->dailyAt('00:05')
  41. ->withoutOverlapping()->appendOutputTo($path);
  42. $schedule->command('ranking:list')
  43. ->dailyAt('00:05')
  44. ->withoutOverlapping()->appendOutputTo($path);
  45. }
  46. }