新增 affiliate_dash 履约配置与商品映射(阶段 3)
- bootstrap CORE_PROFILES + routing ROUTABLE/DEFAULT_PRIORITY 接入 affiliate_dash - planner 上下文 affiliateDash 块 + resolveDynamicAffiliateDashProfile - product-resolution: 91 productNo→sku 映射匹配(skuMapping) + snapshot.affiliateDash - prepare 前余额预检(getAffiliateDashWallet) - AFFILIATE_DASH_SKU_MAPPING_JSON env 注入 - admin 后端接口(GET/POST 配置、match、products、wallet)+ 前端 Tabs 面板 - 联调:模拟 91 进单命中 affiliate_dash 路由, 未命中回退;前后端 typecheck + 212 测试通过
This commit is contained in:
@@ -17,6 +17,7 @@ type RuntimeConfigValue =
|
||||
| AdminDefaultUser[]
|
||||
| KuaishouFeifeiProductRule[]
|
||||
| string[]
|
||||
| Record<string, string>
|
||||
type RuntimeEnv = Record<string, string | undefined>
|
||||
|
||||
type EnvOverride = {
|
||||
@@ -182,6 +183,11 @@ export const ENV_OVERRIDES: readonly EnvOverride[] = [
|
||||
'affiliateDash',
|
||||
'timestampToleranceSeconds',
|
||||
]),
|
||||
affiliateDashSkuMappingEnv('AFFILIATE_DASH_SKU_MAPPING_JSON', [
|
||||
'platforms',
|
||||
'affiliateDash',
|
||||
'skuMapping',
|
||||
]),
|
||||
corsOriginsEnv('CORS_ALLOWED_ORIGINS', ['cors', 'allowedOrigins']),
|
||||
]
|
||||
|
||||
@@ -268,6 +274,28 @@ function kuaishouFeifeiProductRulesEnv(env: string, configPath: RuntimeConfigPat
|
||||
}
|
||||
}
|
||||
|
||||
function affiliateDashSkuMappingEnv(env: string, configPath: RuntimeConfigPath): EnvOverride {
|
||||
return {
|
||||
env,
|
||||
path: configPath,
|
||||
read(rawValue) {
|
||||
const text = String(rawValue ?? '').trim()
|
||||
if (!text) {
|
||||
return null
|
||||
}
|
||||
try {
|
||||
const parsed = JSON.parse(text)
|
||||
if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {
|
||||
return parsed as Record<string, string>
|
||||
}
|
||||
} catch {
|
||||
// 忽略非法 JSON
|
||||
}
|
||||
return null
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
function corsOriginsEnv(env: string, configPath: RuntimeConfigPath): EnvOverride {
|
||||
return {
|
||||
env,
|
||||
|
||||
Reference in New Issue
Block a user