Commit b5a2ec41 authored by ZZH's avatar ZZH

update 2023-7-31

parent 2bb7528c
......@@ -31,7 +31,7 @@ async def update_userinfo_dao(user_id, alias, real_alias):
async def update_user_auth_dao(user_id, sql):
sql = f"update user set {sql} where user_id=%s and is_delete=0"
log.info(sql % (user_id, ))
log.info(sql % (user_id,))
async with MysqlUtil() as conn:
await conn.execute(sql, args=(user_id,))
......@@ -46,7 +46,7 @@ async def update_password_dao(phone, password):
async def search_user_by_wechat_id_dao(wechat_id):
sql = "select * from user where wechat_id = %s and is_delete=0"
async with MysqlUtil() as conn:
data = await conn.fetchone(sql, args=(wechat_id, ))
data = await conn.fetchone(sql, args=(wechat_id,))
return data
......@@ -86,7 +86,7 @@ async def search_user_product_auth_dao(user_id):
sql = "select product,cid_ext,proxy,uassistant_auth" \
" from user_product_auth where user_id = %s "
async with MysqlUtil() as conn:
data = await conn.fetchall(sql, args=(user_id, ))
data = await conn.fetchall(sql, args=(user_id,))
return data
......@@ -129,7 +129,7 @@ async def insert_product_auth_dao(user_id, product, cid_ext, proxy=None,
async def is_having_wechat_id(wechat_id):
sql = "select user_id from user where wechat_id = %s and is_delete=0"
async with MysqlUtil() as conn:
data = await conn.fetchone(sql, args=(wechat_id, ))
data = await conn.fetchone(sql, args=(wechat_id,))
return data
......@@ -150,3 +150,17 @@ async def update_user_info_by_wechat_id(real_name, unit, job, passwd, phone,
async with MysqlUtil() as conn:
await conn.execute(sql, args=(real_name, unit, job, passwd, phone,
wechat_id))
async def load_compy_info(cid):
sql = f"select cid, shortname, fullname, industry, province " \
f"from company where cid = %s;"
async with MysqlUtil() as conn:
return await conn.fetchone(sql, args=(int(cid),))
async def load_compy_logo(cid):
sql = f"SELECT p.logo from proxy p left join company_proxy_map c " \
f"on p.proxy_id = c.proxy where c.cid = %s;"
async with MysqlUtil() as conn:
return await conn.fetchone(sql, args=(int(cid),))
......@@ -16,6 +16,9 @@ from sanic import response
from unify_api.modules.users.procedures.jwt_user import jwt_user
from unify_api.modules.users.procedures.user_product_auth import \
get_product_auth
from unify_api.modules.users.dao.current_user_info_dao import (
load_compy_info, load_compy_logo
)
@summary("用户权限信息")
......@@ -44,19 +47,8 @@ async def get_product_auth_info(request):
# 3. 返回
infos = []
for key, value in res_pro.items():
sql = (
"select cid, shortname, fullname, industry, province "
"from company where cid = %s"
)
async with MysqlUtil() as conn:
company_info = await conn.fetchone(sql=sql, args=(int(key),))
# 增加获取logo url逻辑
logo_sql = (
"SELECT p.logo from proxy p left join company_proxy_map c "
"on p.proxy_id = c.proxy where c.cid = %s"
)
async with MysqlUtil() as conn:
logo_info = await conn.fetchone(sql=logo_sql, args=(int(key),))
company_info = await load_compy_info(key)
logo_info = await load_compy_logo(key)
logo_name = logo_info.get("logo") if logo_info else 'qkyn'
if product_id == 2:
pa = ProductAuth(ext_modules=value, **company_info)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment