update
This commit is contained in:
parent
ff43af5647
commit
2bb3bc26bd
@ -5,6 +5,9 @@ async def mobilecode(ns):
|
|||||||
# 获取操作类型:register 或 login
|
# 获取操作类型:register 或 login
|
||||||
action_type = ns.get('action_type') # register 或 login
|
action_type = ns.get('action_type') # register 或 login
|
||||||
|
|
||||||
|
if not action_type:
|
||||||
|
return {'status': False, 'msg': '操作类型action_type不能为空'}
|
||||||
|
|
||||||
# 通过手机号查找用户
|
# 通过手机号查找用户
|
||||||
mobile = ns.get('mobile')
|
mobile = ns.get('mobile')
|
||||||
if not mobile:
|
if not mobile:
|
||||||
@ -19,8 +22,8 @@ async def mobilecode(ns):
|
|||||||
else:
|
else:
|
||||||
# 注册时手机号不存在,可以发送验证码
|
# 注册时手机号不存在,可以发送验证码
|
||||||
code = await generate_vcode()
|
code = await generate_vcode()
|
||||||
nss = await send_vcode(mobile, '用户注册验证', {'SMSvCode': code.get('vcode')})
|
nss = await send_vcode(mobile, '用户注册登录验证', {'SMSvCode': code.get('vcode')})
|
||||||
if nss:
|
if nss['status']:
|
||||||
return {'status': True, 'msg': '注册验证码发送成功', 'codeid': code.get('id')}
|
return {'status': True, 'msg': '注册验证码发送成功', 'codeid': code.get('id')}
|
||||||
else:
|
else:
|
||||||
return {'status': False, 'msg': '发送失败'}
|
return {'status': False, 'msg': '发送失败'}
|
||||||
@ -30,8 +33,8 @@ async def mobilecode(ns):
|
|||||||
if len(userreacs) >= 1:
|
if len(userreacs) >= 1:
|
||||||
# 登录时手机号存在,可以发送验证码
|
# 登录时手机号存在,可以发送验证码
|
||||||
code = await generate_vcode()
|
code = await generate_vcode()
|
||||||
nss = await send_vcode(userreacs[0]['mobile'], '用户登录验证', {'SMSvCode': code.get('vcode')})
|
nss = await send_vcode(userreacs[0]['mobile'], '用户注册登录验证', {'SMSvCode': code.get('vcode')})
|
||||||
if nss:
|
if nss['status']:
|
||||||
return {'status': True, 'msg': '登录验证码发送成功', 'codeid': code.get('id')}
|
return {'status': True, 'msg': '登录验证码发送成功', 'codeid': code.get('id')}
|
||||||
else:
|
else:
|
||||||
return {'status': False, 'msg': '发送失败'}
|
return {'status': False, 'msg': '发送失败'}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user