erp-backend/app/Console/Commands/RetrySyncCommand.php
2026-04-01 17:07:04 +08:00

29 lines
773 B
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Models\ErpOrder;
use App\Jobs\SyncDeliveryToPlatform;
class RetrySyncCommand extends Command
{
protected $signature = 'orders:retry-sync';
protected $description = '重试回传失败的订单';
public function handle()
{
$failedOrders = ErpOrder::where('sync_status', 2)
->where('delivery_status', 2)
->limit(50)
->get();
foreach ($failedOrders as $order) {
$order->sync_status = 0;
$order->save();
SyncDeliveryToPlatform::dispatch($order->id);
$this->info("已加入重试队列订单ID {$order->id}");
}
$this->info('重试任务触发完成');
}
}