修复履约路由总开关关闭后仍回退默认配置自动发货:总开关关闭即停止自动履约
This commit is contained in:
@@ -6,6 +6,22 @@ import {
|
|||||||
resolveFulfillmentRoute,
|
resolveFulfillmentRoute,
|
||||||
} from './routing-config-service.js'
|
} from './routing-config-service.js'
|
||||||
|
|
||||||
|
test('resolveFulfillmentRoute 总开关关闭后不再回退默认配置,返回未选中', () => {
|
||||||
|
const result = resolveFulfillmentRoute({
|
||||||
|
productName: '测试商品',
|
||||||
|
candidates: [
|
||||||
|
{ executorKey: 'kuaishou_ct_assisted', available: true },
|
||||||
|
{ executorKey: 'kuaishou_feifei', available: true },
|
||||||
|
],
|
||||||
|
config: normalizeFulfillmentRoutingConfig({
|
||||||
|
enabled: false,
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
|
||||||
|
assert.equal(result.selectedExecutorKey, '')
|
||||||
|
assert.equal(result.reason, '履约路由未启用,自动发货已停止')
|
||||||
|
})
|
||||||
|
|
||||||
test('resolveFulfillmentRoute 默认保持 kuaishou-lewan 优先', () => {
|
test('resolveFulfillmentRoute 默认保持 kuaishou-lewan 优先', () => {
|
||||||
const result = resolveFulfillmentRoute({
|
const result = resolveFulfillmentRoute({
|
||||||
productName: '测试商品',
|
productName: '测试商品',
|
||||||
|
|||||||
@@ -149,12 +149,9 @@ export function resolveFulfillmentRoute({
|
|||||||
const skipped: FulfillmentRouteResult['skipped'] = []
|
const skipped: FulfillmentRouteResult['skipped'] = []
|
||||||
|
|
||||||
if (normalizedConfig.enabled === false) {
|
if (normalizedConfig.enabled === false) {
|
||||||
return resolveByExecutorPriority({
|
// 总开关关闭 = 停止自动履约:不再回退默认配置,订单进入待补全队列(isConfigured=false)
|
||||||
priority: DEFAULT_EXECUTOR_PRIORITY,
|
return createEmptyRouteResult(normalizedCandidates, skipped, {
|
||||||
candidates: normalizedCandidates,
|
reason: '履约路由未启用,自动发货已停止',
|
||||||
config: createDefaultFulfillmentRoutingConfig(),
|
|
||||||
skipped,
|
|
||||||
reasonPrefix: '履约路由未启用,使用历史顺序',
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -355,11 +352,12 @@ function createSelectedRouteResult({
|
|||||||
function createEmptyRouteResult(
|
function createEmptyRouteResult(
|
||||||
candidates: FulfillmentRoutingCandidate[],
|
candidates: FulfillmentRoutingCandidate[],
|
||||||
skipped: FulfillmentRouteResult['skipped'],
|
skipped: FulfillmentRouteResult['skipped'],
|
||||||
|
options: { reason?: string } = {},
|
||||||
): FulfillmentRouteResult {
|
): FulfillmentRouteResult {
|
||||||
return {
|
return {
|
||||||
selectedExecutorKey: '',
|
selectedExecutorKey: '',
|
||||||
selectedRuleId: '',
|
selectedRuleId: '',
|
||||||
reason: '',
|
reason: options.reason || '',
|
||||||
matchedRule: null,
|
matchedRule: null,
|
||||||
candidates,
|
candidates,
|
||||||
skipped,
|
skipped,
|
||||||
|
|||||||
Reference in New Issue
Block a user