From c3b50264cc2d3af5aa870f3d42761f8aeece3dab Mon Sep 17 00:00:00 2001 From: hailin Date: Thu, 25 Dec 2025 00:28:29 -0800 Subject: [PATCH] =?UTF-8?q?fix(kyc):=20=E4=BF=AE=E6=AD=A3=E9=98=BF?= =?UTF-8?q?=E9=87=8C=E4=BA=91=E6=89=8B=E6=9C=BA=E5=8F=B7=E4=B8=89=E8=A6=81?= =?UTF-8?q?=E7=B4=A0=E6=A0=B8=E9=AA=8C=E7=9A=84=E6=88=90=E5=8A=9F=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 阿里云 Mobile3MetaSimpleVerify 返回的 BizCode: - 1: 校验一致 (成功) - 2: 校验不一致 (失败) - 3: 查无记录 (失败) 之前错误地将 BizCode=0 判断为成功,现改为 BizCode=1 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .../external/kyc/aliyun-kyc.provider.ts | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/backend/services/identity-service/src/infrastructure/external/kyc/aliyun-kyc.provider.ts b/backend/services/identity-service/src/infrastructure/external/kyc/aliyun-kyc.provider.ts index ef4ae404..269ec2d9 100644 --- a/backend/services/identity-service/src/infrastructure/external/kyc/aliyun-kyc.provider.ts +++ b/backend/services/identity-service/src/infrastructure/external/kyc/aliyun-kyc.provider.ts @@ -127,12 +127,16 @@ export class AliyunKycProvider { // Mobile3MetaSimpleVerify 返回结果: // - Code: OK 表示请求成功 - // - ResultObject.BizCode: 0 表示验证通过, 其他值表示验证失败 + // - ResultObject.BizCode: 核验结果 + // - 1: 校验一致 (成功) + // - 2: 校验不一致 (失败) + // - 3: 查无记录 (失败) if (response.Code === 'OK' || response.Code === '200') { const bizCode = response.ResultObject?.BizCode; const isConsistent = response.ResultObject?.IsConsistent; const subCode = response.ResultObject?.SubCode; - const isMatch = isConsistent === '1' || bizCode === '0'; + // BizCode === '1' 表示校验一致(成功) + const isMatch = bizCode === '1'; this.logger.log(`[AliyunKYC] [Level1] ResultObject: BizCode=${bizCode}, IsConsistent=${isConsistent}, SubCode=${subCode}`); @@ -171,16 +175,15 @@ export class AliyunKycProvider { /** * 映射手机号三要素核验错误码 + * 阿里云 Mobile3MetaSimpleVerify 返回的 BizCode: + * - 1: 校验一致 (成功) + * - 2: 校验不一致 (失败) + * - 3: 查无记录 (失败) */ private mapMobile3MetaErrorCode(bizCode: string): string { const errorMap: Record = { - '1': '姓名与身份证号不匹配', - '2': '身份证号与手机号不匹配', - '3': '姓名与手机号不匹配', - '4': '三要素信息均不匹配', - '5': '无法查询到该手机号信息', - '6': '手机号已注销或停机', - '7': '查询失败,请稍后重试', + '2': '三要素信息校验不一致', + '3': '查无记录,请确认信息是否正确', }; return errorMap[bizCode] || `验证失败 (错误码: ${bizCode})`; }