fix(finance): 重写履约路由迁移与统一渠道配置

重写 120/121 迁移,统一内部 SKU、渠道 id、config_json 和旧规则转换。

后台渠道配置改读统一渠道表,卡券与人工配置不再写旧规则。

增加安全渠道切换,并排除已关闭、失败或过期的历史任务载体。

按生产 119 基线重跑迁移、完整履约财务链路和严格预检。
This commit is contained in:
yml2213
2026-11-02 15:29:13 +08:00
parent 2f87445ed9
commit 6bf28489e0
31 changed files with 958 additions and 464 deletions
@@ -24,9 +24,7 @@ export type PendingChannelGroupListResult = {
/** 渠道规则(L1)。 */
export type ChannelRule = {
id: number
provider: string
shop_id: string
match_key_type: 'sku_code' | 'internal_sku' | 'sku_name'
match_key_type: 'internal_sku'
match_key: string
channel: 'work_order' | 'affiliate_dash' | 'third_party_voucher' | 'manual'
priority: number
@@ -117,14 +115,24 @@ export function assignChannelToItems(payload: {
)
}
export function switchChannelForItems(payload: {
orderItemIds: number[]
channel: string
note?: string
}) {
return apiPost<{
switched: number
failed: number
errors: Array<{ orderItemId: number; reason: string }>
}>('/api/v1/admin/fulfillment/switch', payload)
}
export function fetchChannelRules(params: { channel?: string } = {}) {
return apiGet<ChannelRule[]>('/api/v1/admin/fulfillment/rules', params)
}
export function saveChannelRule(payload: {
id?: number
provider?: string
shopId?: string
matchKeyType: string
matchKey: string
channel: string