履约配置页 affiliate-dash 覆盖收尾:preferredMatchEnabled 开关补入平台配置 UI

- 分析结论:履约路由面板已含 affiliate_dash(开关/优先级/规则),职责划分成立
- 缺口修复:指定匹配优先开关此前无 UI 入口,现平台配置 affiliate-dash tab 增加 Switch
- 后端 effective 透出 preferredMatchEnabled;前端类型/panel 补齐
- 前后端 typecheck 通过,224 测试全绿
This commit is contained in:
yml2213
2026-08-05 17:52:14 +08:00
parent 5f5a1a8bcf
commit 316ee6d135
4 changed files with 32 additions and 0 deletions
@@ -72,6 +72,7 @@ function mapEffectiveAffiliateDashConfig(config: ReturnType<typeof getAffiliateD
timeoutMs: config.timeoutMs, timeoutMs: config.timeoutMs,
notifyUrl: config.notifyUrl, notifyUrl: config.notifyUrl,
timestampToleranceSeconds: config.timestampToleranceSeconds, timestampToleranceSeconds: config.timestampToleranceSeconds,
preferredMatchEnabled: config.preferredMatchEnabled !== false,
hasAppKey: Boolean(config.appKey), hasAppKey: Boolean(config.appKey),
hasAppSecret: Boolean(config.appSecret), hasAppSecret: Boolean(config.appSecret),
hasCallbackSecret: Boolean(config.callbackSecret), hasCallbackSecret: Boolean(config.callbackSecret),
@@ -2300,6 +2300,7 @@ function AffiliateDashPlatformPanel() {
const [saving, setSaving] = useState(false) const [saving, setSaving] = useState(false)
const [errorMessage, setErrorMessage] = useState('') const [errorMessage, setErrorMessage] = useState('')
const [enabled, setEnabled] = useState(true) const [enabled, setEnabled] = useState(true)
const [preferredMatchEnabled, setPreferredMatchEnabled] = useState(true)
const [baseUrl, setBaseUrl] = useState('') const [baseUrl, setBaseUrl] = useState('')
const [appKey, setAppKey] = useState('') const [appKey, setAppKey] = useState('')
const [appSecret, setAppSecret] = useState('') const [appSecret, setAppSecret] = useState('')
@@ -2346,6 +2347,7 @@ function AffiliateDashPlatformPanel() {
function hydrateConfig(response: AdminAffiliateDashConfigResponse) { function hydrateConfig(response: AdminAffiliateDashConfigResponse) {
const source = response.source const source = response.source
setEnabled(source.enabled !== false) setEnabled(source.enabled !== false)
setPreferredMatchEnabled(source.preferredMatchEnabled !== false)
setBaseUrl(source.baseUrl || '') setBaseUrl(source.baseUrl || '')
setAppKey(source.appKey || '') setAppKey(source.appKey || '')
setAppSecret(source.appSecret || '') setAppSecret(source.appSecret || '')
@@ -2368,6 +2370,7 @@ function AffiliateDashPlatformPanel() {
try { try {
const payload: AdminAffiliateDashConfig = { const payload: AdminAffiliateDashConfig = {
enabled, enabled,
preferredMatchEnabled,
baseUrl, baseUrl,
appKey, appKey,
appSecret, appSecret,
@@ -2464,6 +2467,8 @@ function AffiliateDashPlatformPanel() {
<Space> <Space>
<Typography.Text></Typography.Text> <Typography.Text></Typography.Text>
<Switch checked={enabled} onChange={setEnabled} /> <Switch checked={enabled} onChange={setEnabled} />
<Typography.Text type="secondary"></Typography.Text>
<Switch checked={preferredMatchEnabled} onChange={setPreferredMatchEnabled} />
</Space> </Space>
<Space wrap> <Space wrap>
<span>BASE_URL</span> <span>BASE_URL</span>
@@ -7,6 +7,7 @@ export interface AdminAffiliateDashConfig {
timeoutMs: number timeoutMs: number
notifyUrl: string notifyUrl: string
timestampToleranceSeconds: number timestampToleranceSeconds: number
preferredMatchEnabled: boolean
skuMapping: Record<string, string> skuMapping: Record<string, string>
} }
@@ -16,6 +17,7 @@ export interface AdminAffiliateDashEffectiveConfig {
timeoutMs: number timeoutMs: number
notifyUrl: string notifyUrl: string
timestampToleranceSeconds: number timestampToleranceSeconds: number
preferredMatchEnabled: boolean
hasAppKey: boolean hasAppKey: boolean
hasAppSecret: boolean hasAppSecret: boolean
hasCallbackSecret: boolean hasCallbackSecret: boolean
@@ -731,3 +731,27 @@ order_site 处理要求:
- **履约配置**`AdminPlatformFulfillmentPage`):履约路由、kuaishou-feifei 履约、kuaishou-lewan 履约 —— 通道路由与履约参数 - **履约配置**`AdminPlatformFulfillmentPage`):履约路由、kuaishou-feifei 履约、kuaishou-lewan 履约 —— 通道路由与履约参数
**验证**:前端 `tsc -b --noEmit` 通过;后端未改动。 **验证**:前端 `tsc -b --noEmit` 通过;后端未改动。
---
## 25. 履约配置页 affiliate-dash 覆盖分析(v2.10 · 已完成)
**需求**:确认履约配置页是否也需要 affiliate-dash 相关内容(账号归平台配置页)。
### 分析结论
| 配置项 | 归属 | 现状 |
| --- | --- | --- |
| 对接凭据(appKey/appSecret/callbackSecret/baseUrl/timeout/容差) | 平台配置 | ✅ 平台配置页 affiliate-dash tab |
| 钱包 / 商品目录 / 映射测试 | 平台配置 | ✅ 平台配置页 affiliate-dash tab |
| 91 编码 → sku 映射表 | 平台配置 | ✅ 平台配置页 affiliate-dash tab |
| **履约路由**:通道开关(affiliate_dash enabled | 履约配置 | ✅ 履约路由面板已含(ROUTING_EXECUTORS |
| **通道优先级**defaultExecutorPriority 含 affiliate_dash,可上移/下移) | 履约配置 | ✅ 履约路由面板已含 |
| **商品路由规则**(商品名 → affiliate_dash) | 履约配置 | ✅ 履约路由面板规则编辑器已含 |
| **指定匹配优先开关**preferredMatchEnabled | 平台配置 | ⚠️ 新增字段未暴露 UI → **本次已补** |
**结论**:「账号在平台配置、路由在履约配置」的职责划分**已成立**——履约路由面板在阶段 3 就已纳入 affiliate_dash(通道开关/优先级/规则)。本次仅修复一个真实缺口:`preferredMatchEnabled`(映射命中优先,默认 true)此前只能靠默认值或环境变量,后台改不了;现已在平台配置 affiliate-dash tab 增加开关,前后端 effective/source 均透出。
**未新增**:履约配置页不加独立「affiliate-dash 履约面板」——feifei/lewan 有独立面板是因为履约参数多(productRules、deliveryItems 等),affiliate_dash 履约参数只有路由+优先级+规则,已覆盖,加面板属重复。
**验证**:前端 `tsc -b --noEmit` 通过;后端 typecheck 通过;224 测试全绿。