fix(auth): 修正 response.body 可能为 undefined 的 TS 类型错误

This commit is contained in:
hailin 2026-03-10 20:27:28 -07:00
parent a2313734b4
commit 41cd442ce7
1 changed files with 4 additions and 3 deletions

View File

@ -168,11 +168,12 @@ export class SmsService {
});
const response = await client.sendSms(request);
if (response.body.code !== 'OK') {
this.logger.error(`阿里云短信发送失败: ${response.body.code} - ${response.body.message}`);
const body = response.body;
if (!body || body.code !== 'OK') {
this.logger.error(`阿里云短信发送失败: ${body?.code} - ${body?.message}`);
throw new BadRequestException('短信发送失败,请稍后重试');
}
this.logger.log(`短信发送成功: ${phone}, BizId: ${response.body.bizId}`);
this.logger.log(`短信发送成功: ${phone}, BizId: ${body.bizId}`);
}
}