fix: generate_sms_code raises exception with error details instead of returning None
This commit is contained in:
parent
8a2a7d02ed
commit
b1e08c46f5
@ -173,14 +173,14 @@ class SMSEngine:
|
|||||||
'del_flg': '0',
|
'del_flg': '0',
|
||||||
'create_at': datetime.datetime.now()
|
'create_at': datetime.datetime.now()
|
||||||
})
|
})
|
||||||
vcode = {'SMSvCode': code}
|
vcode = {'SMSvCode': code}
|
||||||
# d = await self.send_vcode(phone, "用户注册登录验证", vcode)
|
# d = await self.send_vcode(phone, "用户注册登录验证", vcode)
|
||||||
d = await self.send_vcode(phone, "用户注册登录验证", vcode)
|
d = await self.send_vcode(phone, "用户注册登录验证", vcode)
|
||||||
debug(f'{d=}, {code=}, {phone=}')
|
debug(f'{d=}, {code=}, {phone=}')
|
||||||
if d['status']:
|
if d['status']:
|
||||||
return code_id, code
|
return code_id, code
|
||||||
else:
|
else:
|
||||||
return None
|
raise Exception(d.get('msg', '短信发送失败'))
|
||||||
|
|
||||||
async def check_sms_code(self, code_id: str, vcode: str) -> bool:
|
async def check_sms_code(self, code_id: str, vcode: str) -> bool:
|
||||||
env = ServerEnv()
|
env = ServerEnv()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user