fix: some
All checks were successful
构建并部署前端到测试环境 / deploy (push) Successful in 56s

This commit is contained in:
luo
2026-10-13 17:21:46 +08:00
parent b2a76adc9a
commit c31183205d
13 changed files with 427 additions and 18 deletions

View File

@@ -22,3 +22,26 @@ export const getExchangeBusinessErrorMessage = (value: unknown): string | undefi
const failure = getBusinessFailure(value)
return failure?.msg || failure?.message
}
export interface ExchangeNewAssetContext {
asset_identifier?: string
associated_phones?: string[] | null
}
// 新资产上下文由提交时选中的资产提供,绝不回退到旧资产。
export const getExchangePhoneAssociationQuery = (
failure: unknown,
newAsset: ExchangeNewAssetContext
): { asset_identifier: string; phone: string } | undefined => {
const response = getBusinessFailure(failure)
if (Number(response?.code) !== 1202) return undefined
const asset_identifier = newAsset.asset_identifier?.trim() || ''
const responsePhone = typeof response?.data?.phone === 'string' ? response.data.phone.trim() : ''
const phone =
responsePhone ||
newAsset.associated_phones
?.find((value) => typeof value === 'string' && value.trim())
?.trim() ||
''
return asset_identifier && phone ? { asset_identifier, phone } : undefined
}