Kernel.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. namespace App\Console;
  3. use Illuminate\Console\Scheduling\Schedule;
  4. use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
  5. use Illuminate\Support\Facades\Log;
  6. class Kernel extends ConsoleKernel
  7. {
  8. /**
  9. * Define the application's command schedule.
  10. *
  11. * @param \Illuminate\Console\Scheduling\Schedule $schedule
  12. * @return void
  13. */
  14. protected function schedule(Schedule $schedule)
  15. {
  16. Log::info('schedule start');
  17. $schedule->command('upgrade:daily')
  18. ->dailyAt('00:00')
  19. ->emailOutputTo(config("app.email.ScheduleEmailOutputTo"))
  20. ->emailOutputOnFailure(config("app.email.ScheduleEmailOutputOnFailure"));
  21. $schedule->command('upgrade:weekly')
  22. ->weekly()
  23. ->emailOutputOnFailure(config("app.email.ScheduleEmailOutputOnFailure"));
  24. }
  25. /**
  26. * Register the commands for the application.
  27. *
  28. * @return void
  29. */
  30. protected function commands()
  31. {
  32. $this->load(__DIR__.'/Commands');
  33. require base_path('routes/console.php');
  34. }
  35. /**
  36. * Get the timezone that should be used by default for scheduled events.
  37. *
  38. * @return \DateTimeZone|string|null
  39. */
  40. protected function scheduleTimezone()
  41. {
  42. return 'Asia/Shanghai';
  43. }
  44. }