49 lines
1.7 KiB
Plaintext
49 lines
1.7 KiB
Plaintext
async def check_user_info(ns={}):
|
|
db = DBPools()
|
|
async with db.sqlorContext('kboss') as sor:
|
|
try:
|
|
account_exist = await sor.R('jd_users', {'mobile': ns.get('mobile')})
|
|
if account_exist:
|
|
return {
|
|
'status': False,
|
|
'msg': 'user has been synchronous'
|
|
}
|
|
userid_exist = await sor.R('jd_users', {'userid': await get_user()})
|
|
if userid_exist:
|
|
return {
|
|
'status': False,
|
|
'msg': 'user id has been synchronous'
|
|
}
|
|
checkUserInfo = {
|
|
'checkType': 'mobile',
|
|
'checkValue': '0086-' + ns.get('mobile')
|
|
}
|
|
|
|
parameters = JDAPI.CheckUserRequest.CheckUserParameters(partnerId="44733868076", checkUserInfo=checkUserInfo)
|
|
request = JDAPI.CheckUserRequest.CheckUserRequest(parameters)
|
|
resp = JDAPI.CpClient.send(request)
|
|
|
|
if resp.error:
|
|
error_msg = resp.error.message
|
|
return {
|
|
'status': False,
|
|
'msg': 'interface have error, %s' % error_msg
|
|
}
|
|
elif resp.result.get('status') == 1:
|
|
return {
|
|
'status': False,
|
|
'msg': 'mobile has been synchronous'
|
|
}
|
|
else:
|
|
return {
|
|
'status': True,
|
|
'msg': 'mobile can synchronous'
|
|
}
|
|
except Exception as e:
|
|
return {
|
|
'status': False,
|
|
'err_msg': str(e)
|
|
}
|
|
|
|
ret = await check_user_info(params_kw)
|
|
return ret |