修复 lewan 发货后 claim 轮询换号污染绑定与 UID 展示
发货成功时写入 shipped 身份快照,并冻结绑定资源变更;后台 UID 匹配优先使用发货快照,避免误报不一致。
This commit is contained in:
@@ -14,6 +14,7 @@ import { TASK_STATUS, normalizeTaskStatus } from '../../../domain/task-status.js
|
||||
import {
|
||||
KUAISHOU_CLOUD_FIXED_VN_KEY,
|
||||
isKuaishouCloudBindUrlFresh,
|
||||
isKuaishouCloudBindingMutationFrozen,
|
||||
isKuaishouCloudTask,
|
||||
maskPhone,
|
||||
normalizeKuaishouCloudFlow,
|
||||
@@ -65,6 +66,16 @@ export async function prepareKuaishouCloudFulfillmentTask(task: TaskRow, options
|
||||
const claimLinkState = await ensureTaskClaimLink(task)
|
||||
const source = String(options.source || 'system').trim() || 'system'
|
||||
|
||||
// 已发货:禁止 prepare / 过期换号把状态打回 waiting_binding
|
||||
if (isKuaishouCloudBindingMutationFrozen(task, flow)) {
|
||||
return {
|
||||
task,
|
||||
claimUrl: buildClaimUrl(String(task.primary_claim_token || task.claim_token || '')),
|
||||
token: String(task.primary_claim_token || task.claim_token || ''),
|
||||
flow,
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
!force &&
|
||||
flow.binding.prepareStatus === 'ready' &&
|
||||
@@ -373,6 +384,13 @@ export async function refreshKuaishouCloudTaskBindUrl(task: TaskRow, options: Js
|
||||
const allowSkipBack = options.allowSkipBack !== false
|
||||
const preferReuseVn = options.preferReuseVn !== false
|
||||
|
||||
if (isKuaishouCloudBindingMutationFrozen(task, flow)) {
|
||||
throw createHttpError('当前任务已经发货,不能刷新或更换绑定链接', {
|
||||
statusCode: 409,
|
||||
errorCode: 'kuaishou_cloud_bind_url_refresh_after_dispatch_forbidden',
|
||||
})
|
||||
}
|
||||
|
||||
if (!flow.binding.vnId || !flow.binding.vnKey) {
|
||||
throw createHttpError('当前任务缺少可刷新绑定链接的虚拟号信息', {
|
||||
statusCode: 409,
|
||||
|
||||
Reference in New Issue
Block a user