优化券码操作类型, 增加手动销毁

This commit is contained in:
yml2213
2026-07-12 18:46:30 +08:00
parent 1b8cdf16d3
commit 3d760f987c
16 changed files with 481 additions and 29 deletions
@@ -66,6 +66,7 @@ async function insertKuaishouIndustryVoucher(
unit_index,
seller_id,
token,
eticket_type,
status,
valid_start_time,
valid_end_time,
@@ -94,17 +95,18 @@ async function insertKuaishouIndustryVoucher(
$9,
$10,
$11,
$12::jsonb,
$13,
$12,
$13::jsonb,
$14,
$15,
$16,
$17,
$18::jsonb,
$19,
$20::jsonb,
$21,
$22
$18,
$19::jsonb,
$20,
$21::jsonb,
$22,
$23
)
ON CONFLICT (oid, unit_index) DO UPDATE
SET
@@ -116,6 +118,10 @@ async function insertKuaishouIndustryVoucher(
WHEN EXCLUDED.token <> '' THEN EXCLUDED.token
ELSE kuaishou_industry_vouchers.token
END,
eticket_type = CASE
WHEN EXCLUDED.eticket_type <> '' THEN EXCLUDED.eticket_type
ELSE kuaishou_industry_vouchers.eticket_type
END,
order_id = COALESCE(kuaishou_industry_vouchers.order_id, EXCLUDED.order_id),
task_id = COALESCE(kuaishou_industry_vouchers.task_id, EXCLUDED.task_id),
valid_start_time = EXCLUDED.valid_start_time,
@@ -157,6 +163,7 @@ async function insertKuaishouIndustryVoucher(
input.unitIndex,
input.sellerId || '',
input.token || '',
input.eticketType || '',
input.status || 'UNUSED',
input.validStartTime || 0,
input.validEndTime || 0,
@@ -407,6 +414,10 @@ function normalizeVoucherPatchColumns(
columns.push({ column: 'seller_id', value: patch.sellerId || '' })
}
if (patch.eticketType !== undefined) {
columns.push({ column: 'eticket_type', value: patch.eticketType || '' })
}
if (patch.status !== undefined) {
columns.push({ column: 'status', value: patch.status || 'UNUSED' })
}