优化订单履约分流与后台筛选

This commit is contained in:
yml2213
2026-09-02 11:59:38 +08:00
parent 50c526a855
commit de63daf1ac
19 changed files with 1269 additions and 162 deletions
@@ -480,23 +480,29 @@ async function syncOpen91OrderAfterSendCallbackSuccess(
}
const tasks = await listTasksByOrderId(order.id)
if (tasks.length > 0) {
await bindKuaishouIndustryVouchersToOrderTasks(order, tasks, {
source,
now: normalizeTimestampIso(new Date().toISOString()),
})
return
}
try {
const result = await retryOpen91Order(order.id)
const synchronizedTasks = result.tasks.length > 0 ? result.tasks : tasks
if (synchronizedTasks.length > 0) {
await bindKuaishouIndustryVouchersToOrderTasks(order, synchronizedTasks, {
source,
now: normalizeTimestampIso(new Date().toISOString()),
})
}
logIntegration('[kuaishou-industry/send-code]', '电子凭证发货回调成功后已触发 91 订单重试', {
source,
oid: normalizedOid,
orderId: order.id,
taskCount: result.tasks.length,
previousTaskCount: tasks.length,
})
} catch (error) {
if (tasks.length > 0) {
await bindKuaishouIndustryVouchersToOrderTasks(order, tasks, {
source,
now: normalizeTimestampIso(new Date().toISOString()),
})
}
if (isOpen91OrderAwaitingFulfillmentConfig(error)) {
return
}