优化核销展示

This commit is contained in:
yml2213
2026-07-11 21:19:33 +08:00
parent bae8715f5d
commit 38c022e20c
5 changed files with 146 additions and 49 deletions
@@ -6,6 +6,7 @@ import {
listKuaishouIndustryVouchersForAdmin,
updateKuaishouIndustryVoucherByCode,
type KuaishouIndustryVoucherAdminListQuery,
type KuaishouIndustryVoucherAdminListRow,
} from '../../repositories/kuaishou-industry-voucher-repo.js'
import { getOrderById } from '../../repositories/order-repo.js'
import { getTaskById } from '../../repositories/task-repo.js'
@@ -395,19 +396,23 @@ function sanitizeOpenApiRequest(request: JsonObject | undefined): JsonObject | n
}
function mapAdminKuaishouIndustryVoucher(
voucher: KuaishouIndustryVoucherRow,
voucher: KuaishouIndustryVoucherRow | KuaishouIndustryVoucherAdminListRow,
shopNameBySellerId: Map<string, string> = buildKuaishouIndustryShopNameMap(),
) {
const sellerId = String(voucher.seller_id || '').trim()
const listRow = voucher as KuaishouIndustryVoucherAdminListRow
return {
id: voucher.id,
voucherCode: voucher.voucher_code,
oid: voucher.oid,
orderId: voucher.order_id,
taskId: voucher.task_id,
taskNo: String(listRow.task_no || '').trim(),
unitIndex: voucher.unit_index,
sellerId,
shopName: shopNameBySellerId.get(sellerId) || '',
skuCode: String(listRow.sku_code || '').trim(),
skuName: String(listRow.sku_name || '').trim(),
tokenMasked: maskSecret(voucher.token),
status: voucher.status,
validStartTime: Number(voucher.valid_start_time || 0) || 0,