fix: 腾讯短信检测是否发送成功

pull/6860/head
xinwen 2021-09-15 15:07:34 +08:00 committed by Jiangjie.Bai
parent f3906ff998
commit bf68ddf09e
1 changed files with 9 additions and 0 deletions

View File

@ -82,6 +82,15 @@ class TencentSMS(BaseSMSClient):
resp = self.client.SendSms(req)
try:
code = resp.SendStatusSet[0].Code
msg = resp.SendStatusSet[0].Message
except IndexError:
raise JMSException(code='response_bad', detail=resp)
if code.lower() != 'ok':
raise JMSException(code=code, detail=msg)
return resp
except TencentCloudSDKException as e:
raise JMSException(code=e.code, detail=e.message)