修复历史电子凭证任务操作入口

This commit is contained in:
yml2213
2026-07-08 17:44:32 +08:00
parent 5f29e73205
commit 9a6d083096
2 changed files with 78 additions and 2 deletions
@@ -969,6 +969,30 @@ async function getRequiredIndustryVoucherForTask(task: TaskRow): Promise<Kuaisho
}
}
const oidVouchers = await resolveIndustryVouchersForOrder(task.platform_order_id)
if (voucherCode) {
const matchedByCode = oidVouchers.find(
(voucher) => String(voucher.voucher_code || '').trim() === voucherCode,
)
if (matchedByCode) {
return matchedByCode
}
}
const unitIndex = Number(task.unit_index || 0) || 0
if (unitIndex > 0) {
const matchedByUnit = oidVouchers.find(
(voucher) => Number(voucher.unit_index || 0) === unitIndex,
)
if (matchedByUnit) {
return matchedByUnit
}
}
if (oidVouchers.length === 1 && oidVouchers[0]) {
return oidVouchers[0]
}
throw createHttpError('当前任务没有关联电子凭证,无法执行该操作', {
statusCode: 409,
errorCode: 'admin_task_kuaishou_industry_voucher_missing',