feat(fulfillment): 接入Rock发货平台(0666.pro)代理履约、通用库存池与UID强一致风控

1. 数据库新增 012_rock_fulfillment 迁移,创建 rock_configs 配置表与 rock_tokens 通用库存表,补齐黑色ROCK长袖T恤与蓝色运动服上衣商品目录;
2. 封装 RockClient 与 RockService,实现 0666.pro 平台 Bearer Token 极简连通校验、批量采购50个入库、水位监控巡检与自动补货;
3. 新增 RockProvider 实现标准履约路由,引入 Anti-Ghost 旧绑定基线比对与 UID 强一致门禁,扫错号硬阻断并记录为 mismatch 状态;
4. 针对黑色ROCK与蓝色运动服实现动态发货(绑定后发货前动态选择 skin),并提取腾讯官方发货流水号 fulfillId 对账;
5. 新增全局自动发货总开关(Kill Switch),支持一键软熔断降级转人工接单处理;
6. 前端新增 PlatformRock 管理大屏,提供总开关切换、Token配置与连通测试、库存监控、一键补货及错单解冻重置。
This commit is contained in:
yml2213
2026-10-05 14:56:11 +08:00
parent 46ec3574ae
commit ef7f67dd0c
16 changed files with 3421 additions and 2 deletions
+11 -2
View File
@@ -12,10 +12,12 @@ import (
const (
ProviderDLC = "dlc"
ProviderLewan = "lewan"
ProviderRock = "rock"
RoutingModePriority = "priority"
RoutingModeLewan = "lewan"
RoutingModeDLC = "dlc"
RoutingModeRock = "rock"
)
// ProductRoutingConfig 商品履约配置
@@ -62,9 +64,12 @@ func ParseProductRoutingConfig(fulfillmentConfig string, sku string) ProductRout
cfg.DLCGoodID = builtinDLC
}
// 若未配置 RoutingMode:双渠道优先 priority,单渠道按已有 ID / legacy provider 决定
// 若未配置 RoutingMode:优先判断是否为 Rock 渠道专属商品
if cfg.RoutingMode == "" {
if cfg.LewanProductID != "" && cfg.DLCGoodID != "" {
if strings.HasPrefix(sku, "rock_") {
cfg.RoutingMode = RoutingModeRock
cfg.Priority = []string{ProviderRock}
} else if cfg.LewanProductID != "" && cfg.DLCGoodID != "" {
cfg.RoutingMode = RoutingModePriority
cfg.Priority = []string{ProviderLewan, ProviderDLC}
} else if cfg.LewanProductID != "" || legacyProvider == ProviderLewan {
@@ -199,6 +204,10 @@ func (r *FulfillmentRouter) ResolveProviders(order *model.FulfillmentOrder) ([]F
if p, ok := r.providers[ProviderDLC]; ok {
list = append(list, p)
}
case RoutingModeRock:
if p, ok := r.providers[ProviderRock]; ok {
list = append(list, p)
}
case RoutingModePriority:
for _, name := range cfg.Priority {
if p, ok := r.providers[name]; ok {