新增 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:
@@ -7,6 +7,7 @@ import kuaishouFeifeiRouter from "./platform-config/kuaishou-feifei.js";
|
||||
import ninetyoneRouter from "./platform-config/ninetyone.js";
|
||||
import notificationsRouter from "./platform-config/notifications.js";
|
||||
import fulfillmentRoutingRouter from "./platform-config/fulfillment-routing.js";
|
||||
import affiliateDashRouter from "./platform-config/affiliate-dash.js";
|
||||
|
||||
const router = Router();
|
||||
|
||||
@@ -17,5 +18,6 @@ router.use("/platform-config", kuaishouFeifeiRouter);
|
||||
router.use("/platform-config", ninetyoneRouter);
|
||||
router.use("/platform-config", fulfillmentRoutingRouter);
|
||||
router.use("/platform-config", cloudtentaclesRouter);
|
||||
router.use("/platform-config", affiliateDashRouter);
|
||||
|
||||
export default router;
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
import { Router } from "express";
|
||||
|
||||
import {
|
||||
getAdminAffiliateDashConfig,
|
||||
getAdminAffiliateDashWallet,
|
||||
listAdminAffiliateDashProducts,
|
||||
matchAdminAffiliateDashSku,
|
||||
updateAdminAffiliateDashConfig,
|
||||
} from "../../../services/admin/platform-config/affiliate-dash-service.js";
|
||||
import { createJsonHandler } from "../session.js";
|
||||
import type { JsonRecord } from "../../../types/json.js";
|
||||
|
||||
const router = Router();
|
||||
|
||||
router.get(
|
||||
"/affiliate-dash",
|
||||
createJsonHandler(() => getAdminAffiliateDashConfig(), {
|
||||
successMessage: "ok",
|
||||
errorMessage: "读取 affiliate-dash 配置失败",
|
||||
scope: "[admin/platform-config/affiliate-dash]",
|
||||
})
|
||||
);
|
||||
|
||||
router.post(
|
||||
"/affiliate-dash",
|
||||
createJsonHandler(
|
||||
(req) => updateAdminAffiliateDashConfig(req.body as JsonRecord),
|
||||
{
|
||||
successMessage: "affiliate-dash 配置已保存",
|
||||
errorMessage: "保存 affiliate-dash 配置失败",
|
||||
scope: "[admin/platform-config/affiliate-dash]",
|
||||
audit: (_req, data) => {
|
||||
const result = data as JsonRecord;
|
||||
const source = result.source as JsonRecord | undefined;
|
||||
const effective = result.effective as JsonRecord | undefined;
|
||||
|
||||
return {
|
||||
action: "platform_affiliate_dash_config_updated",
|
||||
targetType: "platform_config",
|
||||
targetId: "affiliate_dash",
|
||||
data: {
|
||||
enabled: effective?.enabled !== false,
|
||||
hasAppKey: Boolean(effective?.hasAppKey),
|
||||
hasAppSecret: Boolean(effective?.hasAppSecret),
|
||||
hasCallbackSecret: Boolean(effective?.hasCallbackSecret),
|
||||
skuMappingCount: Number(source?.skuMapping && typeof source.skuMapping === "object"
|
||||
? Object.keys(source.skuMapping).length
|
||||
: 0),
|
||||
},
|
||||
};
|
||||
},
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
router.post(
|
||||
"/affiliate-dash/match",
|
||||
createJsonHandler(
|
||||
(req) => matchAdminAffiliateDashSku(req.body as JsonRecord),
|
||||
{
|
||||
successMessage: "ok",
|
||||
errorMessage: "匹配 affiliate-dash sku 失败",
|
||||
scope: "[admin/platform-config/affiliate-dash/match]",
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
router.post(
|
||||
"/affiliate-dash/products",
|
||||
createJsonHandler(
|
||||
(req) => listAdminAffiliateDashProducts(req.body as JsonRecord),
|
||||
{
|
||||
successMessage: "ok",
|
||||
errorMessage: "查询 affiliate-dash 商品失败",
|
||||
scope: "[admin/platform-config/affiliate-dash/products]",
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
router.post(
|
||||
"/affiliate-dash/wallet",
|
||||
createJsonHandler(() => getAdminAffiliateDashWallet(), {
|
||||
successMessage: "ok",
|
||||
errorMessage: "查询 affiliate-dash 钱包失败",
|
||||
scope: "[admin/platform-config/affiliate-dash/wallet]",
|
||||
})
|
||||
);
|
||||
|
||||
export default router;
|
||||
Reference in New Issue
Block a user