From c7a97878148611675c0dcf86bddbd312d0b3cf54 Mon Sep 17 00:00:00 2001 From: yml2213 Date: Thu, 14 May 2026 13:51:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=A1=E9=AA=8C=E6=A0=B8=E9=94=80=E7=A0=81?= =?UTF-8?q?=E4=BC=9A=E5=85=88=E6=A3=80=E6=9F=A5=20=E4=BD=99=E9=A2=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/backend/data/cloudtentacles-session.json | 4 +- .../claim/kuaishou-cloud-claim-service.js | 41 +++++++++++-------- .../views/claim/KuaishouCloudClaimView.vue | 7 ++-- 3 files changed, 31 insertions(+), 21 deletions(-) diff --git a/apps/backend/data/cloudtentacles-session.json b/apps/backend/data/cloudtentacles-session.json index 025ae511..9d5fa043 100644 --- a/apps/backend/data/cloudtentacles-session.json +++ b/apps/backend/data/cloudtentacles-session.json @@ -1,9 +1,9 @@ { - "token": "rEX46KZqfspDZ5CVtDcyLuo9GF5PUqsp2TOHvLuleA3zdQev8sgLJOOHiTjxxo2NLXEm6VrxNx6i9hhEdbFJQwSI", + "token": "P1ifGvDcxYchECzx51cqL2TzBkntjQtRwxpetU7RDMMjsSCmC8kHU751bJ4rJMSSjQN73QveARqGLIWe078nKvnA", "baseUrl": "https://123.207.217.176", "username": "17665234375", "phone": "17665234375", - "loggedInAt": "2026-05-02T15:19:01.258Z", + "loggedInAt": "2026-05-14T05:47:42.507Z", "deviceId": "-", "deviceType": 0 } diff --git a/apps/backend/src/services/claim/kuaishou-cloud-claim-service.js b/apps/backend/src/services/claim/kuaishou-cloud-claim-service.js index 60e39afa..031a6830 100644 --- a/apps/backend/src/services/claim/kuaishou-cloud-claim-service.js +++ b/apps/backend/src/services/claim/kuaishou-cloud-claim-service.js @@ -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 }) } diff --git a/apps/frontend/src/views/claim/KuaishouCloudClaimView.vue b/apps/frontend/src/views/claim/KuaishouCloudClaimView.vue index 6dc71b42..3878f997 100644 --- a/apps/frontend/src/views/claim/KuaishouCloudClaimView.vue +++ b/apps/frontend/src/views/claim/KuaishouCloudClaimView.vue @@ -36,8 +36,9 @@ const task = computed(() => detail.value?.task || null) const roleName = computed(() => flow.value?.binding.roleName || flow.value?.role.name || '') const roleId = computed(() => flow.value?.binding.roleId || flow.value?.role.rid || '') const isTicketVerified = computed(() => flow.value?.ticket.status === 'verified') -const isBindingPrepared = computed(() => flow.value?.binding.prepareStatus === 'ready') +const isBindingPrepared = computed(() => flow.value?.binding.prepareStatus === 'ready' && Boolean(String(flow.value?.binding.bindUrl || '').trim())) const isBindingPreparing = computed(() => flow.value?.binding.prepareStatus === 'pending') +const canEnterBindingStep = computed(() => isTicketVerified.value && isBindingPrepared.value) const isRoleReady = computed(() => Boolean(roleName.value || roleId.value)) const isRoleConfirmed = computed(() => String(task.value?.status || '').trim() === 'role_confirmed') const isDispatched = computed(() => String(flow.value?.dispatch.status || '').trim() === 'success') @@ -56,7 +57,7 @@ const currentStep = computed(() => { return 3 } - if (isTicketVerified.value) { + if (canEnterBindingStep.value) { return 2 } @@ -71,7 +72,7 @@ const progressText = computed(() => { return '角色已确认,等待兑换' } if (isTicketVerified.value) { - return isBindingPrepared.value ? '请完成扫码绑定' : '系统正在准备绑定资源' + return isBindingPrepared.value ? '请完成扫码绑定' : '绑定资源未准备完成,请重新验证核销码' } return '等待提交核销码' })