35 lines
1.3 KiB
Plaintext
35 lines
1.3 KiB
Plaintext
async def independent_info_add(ns={}):
|
|
"""
|
|
分销商添加独立域名信息
|
|
:param ns:
|
|
:return:
|
|
"""
|
|
ns['domain_name'] = ns.get('domain_name').strip().replace('https://', '').replace('http://', '').replace('/', '')
|
|
db = DBPools()
|
|
async with db.sqlorContext('kboss') as sor:
|
|
try:
|
|
# 查找其它分销商是否已经存在这个域名
|
|
exist_domain_li = await sor.R('reseller', {'domain_name': ns['domain_name']})
|
|
if exist_domain_li:
|
|
exist_domain_id = exist_domain_li[0]['id']
|
|
if exist_domain_id != ns['id']:
|
|
# 查找已经存在的分销商名称
|
|
exist_reseller_name = (await sor.R('organization', {'id': exist_domain_li[0]['orgid']}))[0]['orgname']
|
|
return {
|
|
'status': False,
|
|
'msg': '添加域名失败, %s 已经存在同样的域名' % exist_reseller_name
|
|
}
|
|
await sor.U('reseller', ns)
|
|
return {
|
|
"status": True,
|
|
"msg": "添加成功, 等待审核和部署"
|
|
}
|
|
except Exception as e:
|
|
raise e
|
|
return {
|
|
"status": False,
|
|
"message": "reseller independent info add failed"
|
|
}
|
|
|
|
ret = await independent_info_add(params_kw)
|
|
return ret |