Kernel.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. namespace App\Console;
  3. use App\Console\Commands\ClearLimit;
  4. use App\Console\Commands\VipOutTime;
  5. use Illuminate\Console\Scheduling\Schedule;
  6. use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
  7. class Kernel extends ConsoleKernel
  8. {
  9. /**
  10. * The Artisan commands provided by your application.
  11. *
  12. * @var array
  13. */
  14. protected $commands = [
  15. //
  16. ClearLimit::class, //用户限制
  17. VipOutTime::class, //VIP过期
  18. ];
  19. /**
  20. * Define the application's command schedule.
  21. *
  22. * @param \Illuminate\Console\Scheduling\Schedule $schedule
  23. * @return void
  24. */
  25. protected function schedule(Schedule $schedule)
  26. {
  27. // $schedule->command('inspire')->hourly();
  28. //此处相当于规定同意的定时执行时间,如每天凌晨执行以下任务
  29. $schedule->command('chenglu:clear_limit')->daily()->description('每天凌晨自动清空用户限制');
  30. $schedule->command('chenglu:vip_out_time')->everyMinute()->description('每分钟检查用户会员是否过期');
  31. }
  32. /**
  33. * Register the commands for the application.
  34. *
  35. * @return void
  36. */
  37. protected function commands()
  38. {
  39. $this->load(__DIR__.'/Commands');
  40. require base_path('routes/console.php');
  41. }
  42. }