refactor(fulfillment): 移除飞飞/乐玩通道,仅保留 affiliate_dash
新单只路由 affiliate_dash(未命中走 manual_dispatch);历史飞飞/乐玩任务保留只读 stub,避免订单重同步失败。同步清理 cloudtentacles 调度、Admin 写路径与相关 env。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -6,7 +6,6 @@ import {
|
||||
} from '../../../repositories/kuaishou-industry-voucher-repo.js'
|
||||
import { normalizeTimestampIso } from '../../../utils/time.js'
|
||||
import { parseTaskContext } from '../../../utils/task-json.js'
|
||||
import { normalizeKuaishouCloudFlow } from '../../fulfillment/kuaishou-cloud/domain.js'
|
||||
import {
|
||||
isKuaishouIndustryVoucherSendCallbackSuccess,
|
||||
normalizeKuaishouIndustrySendCallbackStatus,
|
||||
@@ -71,49 +70,11 @@ export async function attachKuaishouIndustryVoucherToTask(
|
||||
context.kuaishouIndustryVoucher,
|
||||
now,
|
||||
)
|
||||
const sendCallbackConfirmed = isKuaishouIndustryVoucherSendCallbackSuccess(voucher)
|
||||
const nextContext: JsonObject = {
|
||||
...context,
|
||||
kuaishouIndustryVoucher: nextVoucherContext,
|
||||
}
|
||||
|
||||
if (
|
||||
sendCallbackConfirmed &&
|
||||
(String(task.executor_key || '').trim() === 'kuaishou_ct_assisted' ||
|
||||
context.kuaishouCloudFulfillment)
|
||||
) {
|
||||
const flow = normalizeKuaishouCloudFlow(context.kuaishouCloudFulfillment)
|
||||
const consumedAt = voucher.consumed_at || nextVoucherContext.consumedAt || null
|
||||
const status = String(voucher.status || 'UNUSED')
|
||||
.trim()
|
||||
.toUpperCase()
|
||||
|
||||
nextContext.kuaishouCloudFulfillment = {
|
||||
...flow,
|
||||
ticket: {
|
||||
...flow.ticket,
|
||||
code: String(voucher.voucher_code || '').trim(),
|
||||
status: status === 'DESTROYED' ? 'destroyed' : 'verified',
|
||||
capturedAt: flow.ticket.capturedAt || now,
|
||||
capturedBy: flow.ticket.capturedBy || {
|
||||
source: options.source || 'kuaishou_industry_voucher',
|
||||
},
|
||||
verifiedAt: flow.ticket.verifiedAt || now,
|
||||
oid: String(voucher.oid || task.platform_order_id || '').trim(),
|
||||
formToken: String(voucher.token || '').trim(),
|
||||
leftCount: status === 'CONSUMED' || status === 'DESTROYED' ? 0 : 1,
|
||||
goodsTitle: flow.ticket.goodsTitle || task.sku_name || task.sku_code || '',
|
||||
},
|
||||
consume: {
|
||||
...flow.consume,
|
||||
status: status === 'CONSUMED' ? 'success' : flow.consume.status,
|
||||
autoConsumeEnabled: true,
|
||||
consumedAt: status === 'CONSUMED' ? consumedAt : flow.consume.consumedAt,
|
||||
errorMessage: '',
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
if (JSON.stringify(context) === JSON.stringify(nextContext)) {
|
||||
return task
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user