fix: generate_sms_code raises exception with error details instead of returning None

This commit is contained in:
yumoqing 2026-05-31 11:56:44 +08:00
parent 8a2a7d02ed
commit b1e08c46f5

View File

@ -173,14 +173,14 @@ class SMSEngine:
'del_flg': '0',
'create_at': datetime.datetime.now()
})
vcode = {'SMSvCode': code}
# d = await self.send_vcode(phone, "用户注册登录验证", vcode)
d = await self.send_vcode(phone, "用户注册登录验证", vcode)
debug(f'{d=}, {code=}, {phone=}')
if d['status']:
return code_id, code
else:
return None
vcode = {'SMSvCode': code}
# d = await self.send_vcode(phone, "用户注册登录验证", vcode)
d = await self.send_vcode(phone, "用户注册登录验证", vcode)
debug(f'{d=}, {code=}, {phone=}')
if d['status']:
return code_id, code
else:
raise Exception(d.get('msg', '短信发送失败'))
async def check_sms_code(self, code_id: str, vcode: str) -> bool:
env = ServerEnv()