PaymentTask.php 943 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. namespace App\Console\Commands;
  3. use Illuminate\Console\Command;
  4. use App\Jobs\PaymentJob;
  5. use Illuminate\Support\Facades\Log;
  6. class PaymentTask extends Command
  7. {
  8. /**
  9. * The name and signature of the console command.
  10. *
  11. * @var string
  12. */
  13. protected $signature = 'payment_task';
  14. /**
  15. * The console command description.
  16. *
  17. * @var string
  18. */
  19. protected $description = 'Command description';
  20. /**
  21. * Execute the console command.
  22. *
  23. * @return int
  24. */
  25. public function handle()
  26. {
  27. $this->info('启动支付订单状态更新循环任务...');
  28. Log::error('启动支付订单状态更新循环任务...'.now());
  29. // 首次启动任务
  30. PaymentJob::dispatch()->delay(now()->addSeconds(10));
  31. $this->info('任务已启动,将在支付订单状态更新后首次执行');
  32. return Command::SUCCESS;
  33. }
  34. }