优化履约匹配:指定匹配(91中文名→sku映射)最高优先 + 映射键归一化
- 91 商品编码全部为中文名(幸运币90个等),运营按中文名→affiliate_dash sku 配置显式映射 - resolveFulfillmentRoute 新增 preferredExecutorKey:映射命中强制优先(规则之前),停用/不可用回退原逻辑 - matchAffiliateDashSku 归一化:NFKC 全角→半角、去空白、小写,先精确再遍历 - preferredMatchEnabled 配置(默认 true,可一键回退,不耽误现有 cloud/feifei 生产) - 测试 +9(221 全绿);行为验证:映射命中/全角/空格命中,未映射回退
This commit is contained in:
@@ -29,6 +29,7 @@ export function getAffiliateDashConfig(overrides: Partial<AffiliateDashRuntimeCo
|
||||
notifyUrl: String(config.notifyUrl || '').trim(),
|
||||
timestampToleranceSeconds:
|
||||
Math.max(1, Number(config.timestampToleranceSeconds || AFFILIATE_DASH_TIMESTAMP_TOLERANCE_SECONDS) || AFFILIATE_DASH_TIMESTAMP_TOLERANCE_SECONDS),
|
||||
preferredMatchEnabled: config.preferredMatchEnabled !== false,
|
||||
skuMapping: isRecord(config.skuMapping) ? config.skuMapping : {},
|
||||
}
|
||||
}
|
||||
@@ -78,6 +79,8 @@ function mergeAffiliateDashConfig(
|
||||
savedValue.timestampToleranceSeconds ||
|
||||
runtimeValue.timestampToleranceSeconds ||
|
||||
AFFILIATE_DASH_TIMESTAMP_TOLERANCE_SECONDS,
|
||||
preferredMatchEnabled:
|
||||
savedValue.preferredMatchEnabled ?? runtimeValue.preferredMatchEnabled ?? true,
|
||||
skuMapping: pickSkuMapping(savedValue.skuMapping, runtimeValue.skuMapping),
|
||||
}
|
||||
: {
|
||||
@@ -90,6 +93,7 @@ function mergeAffiliateDashConfig(
|
||||
notifyUrl: runtimeValue.notifyUrl || '',
|
||||
timestampToleranceSeconds:
|
||||
runtimeValue.timestampToleranceSeconds || AFFILIATE_DASH_TIMESTAMP_TOLERANCE_SECONDS,
|
||||
preferredMatchEnabled: runtimeValue.preferredMatchEnabled ?? true,
|
||||
skuMapping: pickSkuMapping(undefined, runtimeValue.skuMapping),
|
||||
}
|
||||
|
||||
@@ -103,6 +107,7 @@ function mergeAffiliateDashConfig(
|
||||
notifyUrl: overrides.notifyUrl ?? base.notifyUrl,
|
||||
timestampToleranceSeconds:
|
||||
overrides.timestampToleranceSeconds ?? base.timestampToleranceSeconds,
|
||||
preferredMatchEnabled: overrides.preferredMatchEnabled ?? base.preferredMatchEnabled,
|
||||
skuMapping: pickSkuMapping(overrides.skuMapping, base.skuMapping),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ export type AffiliateDashSourceConfig = {
|
||||
timeoutMs: number
|
||||
notifyUrl: string
|
||||
timestampToleranceSeconds: number
|
||||
preferredMatchEnabled: boolean
|
||||
skuMapping: AffiliateDashSkuMapping
|
||||
}
|
||||
|
||||
@@ -54,6 +55,7 @@ export function normalizeAffiliateDashSourceConfig(rawValue: unknown): Affiliate
|
||||
timeoutMs: normalizePositiveInteger(source.timeoutMs, 10000),
|
||||
notifyUrl: String(source.notifyUrl || '').trim(),
|
||||
timestampToleranceSeconds: normalizePositiveInteger(source.timestampToleranceSeconds, 300),
|
||||
preferredMatchEnabled: source.preferredMatchEnabled !== false,
|
||||
skuMapping: normalizeSkuMapping(source.skuMapping),
|
||||
}
|
||||
}
|
||||
@@ -84,6 +86,7 @@ function createDefaultAffiliateDashSourceConfig(): AffiliateDashSourceConfig {
|
||||
timeoutMs: 10000,
|
||||
notifyUrl: '',
|
||||
timestampToleranceSeconds: 300,
|
||||
preferredMatchEnabled: true,
|
||||
skuMapping: {},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user