履约配置页 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,
notifyUrl: config.notifyUrl,
timestampToleranceSeconds: config.timestampToleranceSeconds,
preferredMatchEnabled: config.preferredMatchEnabled !== false,
hasAppKey: Boolean(config.appKey),
hasAppSecret: Boolean(config.appSecret),
hasCallbackSecret: Boolean(config.callbackSecret),
@@ -2300,6 +2300,7 @@ function AffiliateDashPlatformPanel() {
const [saving, setSaving] = useState(false)
const [errorMessage, setErrorMessage] = useState('')
const [enabled, setEnabled] = useState(true)
const [preferredMatchEnabled, setPreferredMatchEnabled] = useState(true)
const [baseUrl, setBaseUrl] = useState('')
const [appKey, setAppKey] = useState('')
const [appSecret, setAppSecret] = useState('')
@@ -2346,6 +2347,7 @@ function AffiliateDashPlatformPanel() {
function hydrateConfig(response: AdminAffiliateDashConfigResponse) {
const source = response.source
setEnabled(source.enabled !== false)
setPreferredMatchEnabled(source.preferredMatchEnabled !== false)
setBaseUrl(source.baseUrl || '')
setAppKey(source.appKey || '')
setAppSecret(source.appSecret || '')
@@ -2368,6 +2370,7 @@ function AffiliateDashPlatformPanel() {
try {
const payload: AdminAffiliateDashConfig = {
enabled,
preferredMatchEnabled,
baseUrl,
appKey,
appSecret,
@@ -2464,6 +2467,8 @@ function AffiliateDashPlatformPanel() {
<Space>
<Typography.Text></Typography.Text>
<Switch checked={enabled} onChange={setEnabled} />
<Typography.Text type="secondary"></Typography.Text>
<Switch checked={preferredMatchEnabled} onChange={setPreferredMatchEnabled} />
</Space>
<Space wrap>
<span>BASE_URL</span>
@@ -7,6 +7,7 @@ export interface AdminAffiliateDashConfig {
timeoutMs: number
notifyUrl: string
timestampToleranceSeconds: number
preferredMatchEnabled: boolean
skuMapping: Record<string, string>
}
@@ -16,6 +17,7 @@ export interface AdminAffiliateDashEffectiveConfig {
timeoutMs: number
notifyUrl: string
timestampToleranceSeconds: number
preferredMatchEnabled: boolean
hasAppKey: boolean
hasAppSecret: boolean
hasCallbackSecret: boolean