优化快手云领取发货校验
This commit is contained in:
@@ -43,6 +43,7 @@ import {
|
||||
resolveKuaishouCloudVnKeyCandidates,
|
||||
resolvePersistedCloudtentaclesContext,
|
||||
} from './kuaishou-cloud-helpers.js'
|
||||
import { syncKuaishouCloudRoleInfoBeforeDispatch } from '../../fulfillment/kuaishou-cloud/dispatch-role-sync.js'
|
||||
|
||||
import type {
|
||||
AdminEntityIdInput,
|
||||
@@ -273,31 +274,49 @@ export async function dispatchAdminTaskKuaishouCloudFulfillment(
|
||||
})
|
||||
}
|
||||
|
||||
const synced = await syncKuaishouCloudRoleInfoBeforeDispatch(task, {
|
||||
now,
|
||||
actor: session
|
||||
? {
|
||||
userId: Number(session.userId || 0) || 0,
|
||||
username: String(session.username || '').trim(),
|
||||
role: String(session.role || '').trim(),
|
||||
}
|
||||
: null,
|
||||
source: 'admin_task_dispatch',
|
||||
errorCodePrefix: 'admin_task_kuaishou_cloud',
|
||||
cloudContext,
|
||||
taskContext,
|
||||
flow,
|
||||
})
|
||||
const syncedFlow = synced.flow
|
||||
const syncedTaskContext = synced.taskContext
|
||||
|
||||
const dispatchResult = await useCloudtentaclesSku({
|
||||
...cloudContext,
|
||||
id: flow.binding.skuId,
|
||||
virtualNumberId: flow.binding.vnId,
|
||||
phone: flow.binding.vnPhone,
|
||||
id: syncedFlow.binding.skuId,
|
||||
virtualNumberId: syncedFlow.binding.vnId,
|
||||
phone: syncedFlow.binding.vnPhone,
|
||||
})
|
||||
|
||||
const nextContext = {
|
||||
...taskContext,
|
||||
...syncedTaskContext,
|
||||
kuaishouCloudFulfillment: {
|
||||
...flow,
|
||||
...syncedFlow,
|
||||
ticket: {
|
||||
...flow.ticket,
|
||||
...syncedFlow.ticket,
|
||||
code: ticketCode || persistedTicketCode,
|
||||
capturedAt: ticketCode ? now : flow.ticket.capturedAt,
|
||||
capturedAt: ticketCode ? now : syncedFlow.ticket.capturedAt,
|
||||
capturedBy: ticketCode && session
|
||||
? {
|
||||
userId: Number(session.userId || 0) || 0,
|
||||
username: String(session.username || '').trim(),
|
||||
role: String(session.role || '').trim(),
|
||||
}
|
||||
: flow.ticket.capturedBy,
|
||||
: syncedFlow.ticket.capturedBy,
|
||||
},
|
||||
dispatch: {
|
||||
...flow.dispatch,
|
||||
...syncedFlow.dispatch,
|
||||
status: 'success',
|
||||
dispatchAt: now,
|
||||
dispatchBy: session
|
||||
@@ -325,9 +344,9 @@ export async function dispatchAdminTaskKuaishouCloudFulfillment(
|
||||
|
||||
await createTaskEvent(task.id, 'kuaishou_cloud_dispatched', {
|
||||
ticketCodeMasked: maskCode(ticketCode || persistedTicketCode),
|
||||
skuId: flow.binding.skuId,
|
||||
vnId: flow.binding.vnId,
|
||||
vnPhoneMasked: maskPhone(flow.binding.vnPhone),
|
||||
skuId: syncedFlow.binding.skuId,
|
||||
vnId: syncedFlow.binding.vnId,
|
||||
vnPhoneMasked: maskPhone(syncedFlow.binding.vnPhone),
|
||||
sendType: dispatchResult.sendType,
|
||||
note: dispatchResult.note,
|
||||
}, now)
|
||||
|
||||
Reference in New Issue
Block a user