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; } /**