优化领取页绑定 UID 校验

This commit is contained in:
yml2213
2026-08-05 21:19:09 +08:00
parent 0deb498a05
commit c91dd4d144
5 changed files with 157 additions and 34 deletions
@@ -34,6 +34,27 @@ export function createClaimSnapshot(
const roleId = flow?.role.rid || flow?.binding.roleId || ''
const isFeifeiFlow = detail?.flowType === 'kuaishou_feifei'
const isAffiliateDashFlow = detail?.flowType === 'affiliate_dash'
const affiliateDashExpectedUid = String(
expectedUid || affiliateDash?.expectedGameAccount || affiliateDash?.gameAccount || '',
).trim()
const affiliateDashBoundAccount = String(affiliateDash?.boundAccount || '').trim()
const isAffiliateDashBound = Boolean(affiliateDash?.bound)
const isAffiliateDashUidMatched = Boolean(
isAffiliateDashBound &&
affiliateDashExpectedUid &&
affiliateDashBoundAccount &&
normalizeUid(affiliateDashExpectedUid) === normalizeUid(affiliateDashBoundAccount),
)
const isAffiliateDashBindMismatch = Boolean(
affiliateDash?.bindMismatch ||
(isAffiliateDashBound &&
affiliateDashExpectedUid &&
affiliateDashBoundAccount &&
!isAffiliateDashUidMatched),
)
const isAffiliateDashReadyToSubmit = Boolean(
isAffiliateDashBound && isAffiliateDashUidMatched && !isAffiliateDashBindMismatch,
)
const isBindUrlExpired = isDateExpired(flow?.binding.bindExpiresAt || '')
const isBindingPrepared =
flow?.binding.prepareStatus === 'ready' &&
@@ -70,14 +91,16 @@ export function createClaimSnapshot(
hasKuaishouCloudRedeemResultStatus(task?.status) ||
(isFeifeiFlow && [30, 40, 50, 60].includes(Number(feifei?.rechargeStatus || 0))) ||
(isAffiliateDashFlow &&
['delivered', 'ship_failed', 'cancelled'].includes(String(affiliateDash?.orderStatus || '').trim()))
['delivered', 'ship_failed', 'cancelled'].includes(
String(affiliateDash?.orderStatus || '').trim(),
))
const currentStep = resolveCurrentStep({
hasExpectedUid,
hasRedeemResult,
isRoleConfirmed,
isFeifeiFlow,
isAffiliateDashFlow,
affiliateDash,
isAffiliateDashReadyToSubmit,
})
const progressText = resolveProgressText({
feifei,
@@ -90,6 +113,8 @@ export function createClaimSnapshot(
isRoleConfirmed,
isBindingPrepared,
isUidMatched,
isAffiliateDashReadyToSubmit,
isAffiliateDashBindMismatch,
})
const resultTitle = resolveResultTitle({
isRedeemFailed,
@@ -128,6 +153,12 @@ export function createClaimSnapshot(
roleId,
isFeifeiFlow,
isAffiliateDashFlow,
affiliateDashExpectedUid,
affiliateDashBoundAccount,
isAffiliateDashBound,
isAffiliateDashUidMatched,
isAffiliateDashBindMismatch,
isAffiliateDashReadyToSubmit,
isBindUrlExpired,
isBindingPrepared,
isBindingPreparing,
@@ -182,8 +213,7 @@ function resolveCurrentStep(options: {
isRoleConfirmed: boolean
isFeifeiFlow: boolean
isAffiliateDashFlow: boolean
affiliateDash: ClaimAffiliateDashFlowInfo | null
isUidMatched?: boolean
isAffiliateDashReadyToSubmit: boolean
}) {
if (!options.hasExpectedUid) {
return 1
@@ -192,7 +222,7 @@ function resolveCurrentStep(options: {
return 4
}
if (options.isAffiliateDashFlow) {
if (!options.affiliateDash?.bound) {
if (!options.isAffiliateDashReadyToSubmit) {
return 2
}
return 3
@@ -214,6 +244,8 @@ function resolveProgressText(options: {
isRoleConfirmed: boolean
isBindingPrepared: boolean
isUidMatched: boolean
isAffiliateDashReadyToSubmit: boolean
isAffiliateDashBindMismatch: boolean
}) {
if (!options.hasExpectedUid) {
return '请填写游戏编号'
@@ -227,6 +259,12 @@ function resolveProgressText(options: {
? '请扫码绑定账号'
: '绑定链接生成中,请稍候'
}
if (options.isAffiliateDashBindMismatch) {
return '绑定 UID 不一致,请重新扫码'
}
if (!options.isAffiliateDashReadyToSubmit) {
return '绑定账号确认中,请稍候'
}
return '已绑定,请提交发货'
}
if (options.isFeifeiFlow) {