fix(auth): 修正 response.body 可能为 undefined 的 TS 类型错误
This commit is contained in:
parent
a2313734b4
commit
41cd442ce7
|
|
@ -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}`);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue