<?php


namespace App\Console\Commands;

use Illuminate\Console\Command;
use App\Jobs\PaymentJob;
use Illuminate\Support\Facades\Log;

class PaymentTask extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'payment_task';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Command description';

    /**
     * Execute the console command.
     *
     * @return int
     */
    public function handle()
    {
        $this->info('启动支付订单状态更新循环任务...');
        Log::error('启动支付订单状态更新循环任务...'.now());
        // 首次启动任务
        PaymentJob::dispatch()->delay(now()->addSeconds(10));
        
        $this->info('任务已启动，将在支付订单状态更新后首次执行');
        
        return Command::SUCCESS;
    }
}
