20 lines
1.0 KiB
Plaintext
20 lines
1.0 KiB
Plaintext
async def add_white_list(ns):
|
|
"""用户申请设备发布开白名单"""
|
|
db = DBPools()
|
|
async with db.sqlorContext('kboss') as sor:
|
|
if ns:
|
|
user = await sor.R('white_list', {'user_id': ns.get('user_id')})
|
|
if len(user) >= 1:
|
|
if user[0]['type'] == '0':
|
|
return {'status': True, 'msg': '已申请开权限,请等待审核,请勿重复提交','code':100}
|
|
elif user[0]['type'] == '1':
|
|
return {'status': True, 'code': 200}
|
|
elif user[0]['type'] == '2':
|
|
return {'status': True, 'msg': '渠道权限暂时无法为您开通','code':210}
|
|
if len(user) < 1:
|
|
if ns.get('code'):
|
|
await sor.C('white_list',{'id':uuid(),'user_id':ns.get('user_id')})
|
|
return {'status': True, 'msg': '已申请开权限,请等待审核','code':220}
|
|
return {'status': True, 'code': 300}
|
|
ret = await add_white_list(params_kw)
|
|
return ret |