From e8e2a44fef26e4208cda4f01b9c78eba56ff73da Mon Sep 17 00:00:00 2001 From: hailin Date: Wed, 4 Mar 2026 04:47:01 -0800 Subject: [PATCH] =?UTF-8?q?fix(auth-service):=20=E4=BF=AE=E5=A4=8D=20Alipa?= =?UTF-8?q?yProvider=20TypeScript=20=E7=B1=BB=E5=9E=8B=E9=94=99=E8=AF=AF?= =?UTF-8?q?=20(unknown=20=E7=B1=BB=E5=9E=8B=E6=96=AD=E8=A8=80)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 4.6 --- .../infrastructure/alipay/alipay.provider.ts | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/backend/services/auth-service/src/infrastructure/alipay/alipay.provider.ts b/backend/services/auth-service/src/infrastructure/alipay/alipay.provider.ts index 55fc5f1..61407f3 100644 --- a/backend/services/auth-service/src/infrastructure/alipay/alipay.provider.ts +++ b/backend/services/auth-service/src/infrastructure/alipay/alipay.provider.ts @@ -101,17 +101,17 @@ export class AlipayProvider { code: authCode, }); - const resp = result['alipay_system_oauth_token_response']; + const resp = result['alipay_system_oauth_token_response'] as Record | undefined; if (!resp || result['error_response']) { - const err = result['error_response'] || {}; + const err = (result['error_response'] || {}) as Record; this.logger.error(`Alipay token exchange failed: ${JSON.stringify(err)}`); throw new BadRequestException( - `支付宝授权失败: ${err.sub_msg || err.msg || '未知错误'} (code: ${err.code || '?'})`, + `支付宝授权失败: ${err['sub_msg'] || err['msg'] || '未知错误'} (code: ${err['code'] || '?'})`, ); } - this.logger.log(`Alipay token exchanged: userId=${resp.user_id}`); - return resp as AlipayTokenResponse; + this.logger.log(`Alipay token exchanged: userId=${resp['user_id']}`); + return resp as unknown as AlipayTokenResponse; } /** @@ -126,16 +126,16 @@ export class AlipayProvider { accessToken, ); - const resp = result['alipay_user_info_share_response']; - if (!resp || result['error_response'] || resp.code !== '10000') { - const err = result['error_response'] || resp || {}; + const resp = result['alipay_user_info_share_response'] as Record | undefined; + if (!resp || result['error_response'] || resp['code'] !== '10000') { + const err = (result['error_response'] || resp || {}) as Record; this.logger.error(`Alipay userinfo failed: ${JSON.stringify(err)}`); throw new BadRequestException( - `获取支付宝用户信息失败: ${err.sub_msg || err.msg || '请确认已开通「获取会员信息」接口权限'}`, + `获取支付宝用户信息失败: ${err['sub_msg'] || err['msg'] || '请确认已开通「获取会员信息」接口权限'}`, ); } - return resp as AlipayUserInfo; + return resp as unknown as AlipayUserInfo; } /**