优化履约路由并重命名乐玩通道
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
import {
|
||||
getFulfillmentRoutingConfig,
|
||||
getFulfillmentRoutingConfigFilePath,
|
||||
saveFulfillmentRoutingConfig,
|
||||
} from '../../fulfillment/routing-config-service.js'
|
||||
import { resolveOrderItemForFulfillment } from '../../fulfillment/product-resolution-service.js'
|
||||
import { normalizeCloudtentaclesMatchName } from '../../order/cloudtentacles-match-utils.js'
|
||||
import type { JsonRecord } from '../../../types/json.js'
|
||||
|
||||
export function getAdminFulfillmentRoutingConfig() {
|
||||
return {
|
||||
filePath: getFulfillmentRoutingConfigFilePath(),
|
||||
...getFulfillmentRoutingConfig(),
|
||||
}
|
||||
}
|
||||
|
||||
export function updateAdminFulfillmentRoutingConfig(payload: JsonRecord = {}) {
|
||||
return {
|
||||
filePath: getFulfillmentRoutingConfigFilePath(),
|
||||
...saveFulfillmentRoutingConfig(payload),
|
||||
}
|
||||
}
|
||||
|
||||
export async function previewAdminFulfillmentRouting(payload: JsonRecord = {}) {
|
||||
const productName = String(payload.productName || payload.skuName || '').trim()
|
||||
const item = await resolveOrderItemForFulfillment({
|
||||
provider: '91kaquan',
|
||||
platform: 'kuaishou',
|
||||
item: {
|
||||
itemId: productName,
|
||||
externalItemId: productName,
|
||||
skuCode: productName,
|
||||
skuName: productName,
|
||||
externalSkuCode: productName,
|
||||
externalSkuName: productName,
|
||||
quantity: 1,
|
||||
},
|
||||
})
|
||||
const snapshot = item.snapshot || {}
|
||||
|
||||
return {
|
||||
productName,
|
||||
normalizedProductName: normalizeCloudtentaclesMatchName(productName),
|
||||
resolvedSkuCode: item.skuCode,
|
||||
resolvedSkuName: item.skuName,
|
||||
isConfigured: item.isConfigured,
|
||||
fulfillmentRoute: snapshot.fulfillmentRoute || null,
|
||||
cloudtentacles: snapshot.cloudtentacles || null,
|
||||
kuaishouFeifei: snapshot.kuaishouFeifei || null,
|
||||
}
|
||||
}
|
||||
@@ -80,7 +80,7 @@ export async function prepareAdminTaskKuaishouCloudFulfillment(
|
||||
}
|
||||
|
||||
if (!isKuaishouCloudTask(task)) {
|
||||
throw createHttpError('当前任务不是快手 cloud 履约任务', {
|
||||
throw createHttpError('当前任务不是 kuaishou-lewan 履约任务', {
|
||||
statusCode: 409,
|
||||
errorCode: 'admin_task_not_kuaishou_cloud',
|
||||
})
|
||||
@@ -261,7 +261,7 @@ export async function dispatchAdminTaskKuaishouCloudFulfillment(
|
||||
}
|
||||
|
||||
if (!isKuaishouCloudTask(task)) {
|
||||
throw createHttpError('当前任务不是快手 cloud 履约任务', {
|
||||
throw createHttpError('当前任务不是 kuaishou-lewan 履约任务', {
|
||||
statusCode: 409,
|
||||
errorCode: 'admin_task_not_kuaishou_cloud',
|
||||
})
|
||||
@@ -397,7 +397,7 @@ export async function refreshAdminTaskKuaishouCloudRoleInfo(
|
||||
}
|
||||
|
||||
if (!isKuaishouCloudTask(task)) {
|
||||
throw createHttpError('当前任务不是快手 cloud 履约任务', {
|
||||
throw createHttpError('当前任务不是 kuaishou-lewan 履约任务', {
|
||||
statusCode: 409,
|
||||
errorCode: 'admin_task_not_kuaishou_cloud',
|
||||
})
|
||||
@@ -522,7 +522,7 @@ export async function returnNumberAdminTaskKuaishouCloudFulfillment(
|
||||
}
|
||||
|
||||
if (!isKuaishouCloudTask(task)) {
|
||||
throw createHttpError('当前任务不是快手 cloud 履约任务', {
|
||||
throw createHttpError('当前任务不是 kuaishou-lewan 履约任务', {
|
||||
statusCode: 409,
|
||||
errorCode: 'admin_task_not_kuaishou_cloud',
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user