You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.1 KiB

8 years ago
8 years ago
4 years ago
8 years ago
8 years ago
4 years ago
8 years ago
8 years ago
8 years ago
  1. <?php
  2. namespace App\Console;
  3. use DB;
  4. use Log;
  5. use Illuminate\Console\Scheduling\Schedule;
  6. use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
  7. use App\Console\Commands\GatewayWorkerServer;
  8. class Kernel extends ConsoleKernel
  9. {
  10. /**
  11. * 应用提供的Artisan命令
  12. *
  13. * @var array
  14. */
  15. protected $commands = [
  16. GatewayWorkerServer::class,
  17. Commands\UnpayOrderSetInvalid::class,
  18. Commands\SendEmail::class,
  19. ];
  20. /**
  21. * 定义应用的命令调度
  22. *
  23. * @param \Illuminate\Console\Scheduling\Schedule $schedule
  24. * @return void
  25. */
  26. protected function schedule(Schedule $schedule)
  27. {
  28. Log::info('----Schedule----');
  29. // 使用 command 方法通过命令名或类来调度一个 Artisan 命令
  30. // $schedule->command('unpay_order_set_invalid')->hourly();
  31. // 使用 exec 命令可用于发送命令到操作系统
  32. // $schedule->exec('node /home/forge/script.js')->daily();
  33. }
  34. /**
  35. * Register the Closure based commands for the application.
  36. *
  37. * @return void
  38. */
  39. protected function commands()
  40. {
  41. require base_path('routes/console.php');
  42. }
  43. }