feat(shopro_wechat_trade): 添加重新同步物流信息命令

新增 ResyncShipping 命令,支持强制重新上传微信物流信息,
不依赖 sync 表的 failed/pending 状态,适用于修改自提配置后
需要重传的场景。

同时修改 RetryFailed 命令,在没有待重试记录时提供操作提示,
并扩展 WxShippingService 的 retryFailed 方法支持处理
failed 状态的记录。
```
这个提交包含在:
可乐加冰
2026-10-09 13:01:01 +08:00
父节点 87ce558c07
当前提交 66641f8a05
共有 4 个文件被更改,包括 107 次插入 和 3 次删除

查看文件

@@ -142,9 +142,13 @@ class WxShippingService
{
$now = time();
$rows = Db::name('shopro_wechat_trade_sync')
->where('status', 'pending')
->where('retry_count', '>', 0)
->where('next_retry_time', '<=', $now)
->where(function ($q) use ($now) {
$q->where(function ($q2) use ($now) {
$q2->where('status', 'pending')
->where('retry_count', '>', 0)
->where('next_retry_time', '<=', $now);
})->whereOr('status', 'failed');
})
->order('id', 'asc')
->limit($limit)
->select();
@@ -164,4 +168,34 @@ class WxShippingService
}
return $count;
}
/**
* 按订单号再次调用 upload_shipping_info(已有 success 也会重传,用于改自提等)
*/
public function resyncShippingByOrderSns(array $orderSns)
{
$ok = 0;
$fail = 0;
foreach ($orderSns as $sn) {
$sn = trim((string) $sn);
if ($sn === '') {
continue;
}
$order = Db::name('shopro_order')->where('order_sn', $sn)->find();
if (!$order && strlen($sn) < 24) {
$order = Db::name('shopro_order')->where('order_sn', 'like', $sn . '%')->order('id', 'desc')->find();
}
if (!$order) {
$fail++;
continue;
}
try {
$this->syncOrderShipping((int) $order['id']);
$ok++;
} catch (\Exception $e) {
$fail++;
}
}
return ['ok' => $ok, 'fail' => $fail];
}
}