修复历史电子凭证任务操作入口
This commit is contained in:
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user