校验核销码会先检查 余额
This commit is contained in:
@@ -97,14 +97,31 @@ export async function verifyKuaishouCloudClaimTicket(token, payload = {}) {
|
||||
},
|
||||
}
|
||||
|
||||
const updatedTask = await updateTask(context.task.id, {
|
||||
claim_token: context.claimToken.token,
|
||||
claim_expires_at: context.claimToken.expired_at,
|
||||
claimed_at: context.task.claimed_at || now,
|
||||
context_json: JSON.stringify(nextContext),
|
||||
last_error: '',
|
||||
updated_at: now,
|
||||
})
|
||||
const preparedFlow = normalizeKuaishouCloudFlow(nextContext.kuaishouCloudFulfillment)
|
||||
if (preparedFlow.binding.prepareStatus !== 'ready' || !preparedFlow.binding.bindUrl) {
|
||||
await prepareKuaishouCloudFulfillmentTask({
|
||||
...context.task,
|
||||
context_json: JSON.stringify(nextContext),
|
||||
}, {
|
||||
source: 'claim_page_ticket_verified',
|
||||
actor: { source: 'claim_page' },
|
||||
})
|
||||
} else {
|
||||
await updateTask(context.task.id, {
|
||||
claim_token: context.claimToken.token,
|
||||
claim_expires_at: context.claimToken.expired_at,
|
||||
context_json: JSON.stringify(nextContext),
|
||||
last_error: '',
|
||||
updated_at: now,
|
||||
})
|
||||
}
|
||||
|
||||
if (!context.task.claimed_at) {
|
||||
await updateTask(context.task.id, {
|
||||
claimed_at: now,
|
||||
updated_at: now,
|
||||
})
|
||||
}
|
||||
|
||||
await createTaskEvent(context.task.id, 'kuaishou_cloud_ticket_verified', {
|
||||
ticketCodeMasked: maskCode(detailResult.eTicketId || ticketCode),
|
||||
@@ -113,14 +130,6 @@ export async function verifyKuaishouCloudClaimTicket(token, payload = {}) {
|
||||
goodsTitle: String(detailResult.goods?.itemTitle || '').trim(),
|
||||
}, now)
|
||||
|
||||
const preparedFlow = normalizeKuaishouCloudFlow(nextContext.kuaishouCloudFulfillment)
|
||||
if (preparedFlow.binding.prepareStatus !== 'ready' || !preparedFlow.binding.bindUrl) {
|
||||
await prepareKuaishouCloudFulfillmentTask(updatedTask, {
|
||||
source: 'claim_page_ticket_verified',
|
||||
actor: { source: 'claim_page' },
|
||||
})
|
||||
}
|
||||
|
||||
return getClaimDetail(token, { includeQrImage: false })
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user