Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
U
unify_api2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chaonan
unify_api2
Commits
b5a2ec41
Commit
b5a2ec41
authored
Jul 31, 2023
by
ZZH
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update 2023-7-31
parent
2bb7528c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
17 deletions
+23
-17
current_user_info_dao.py
unify_api/modules/users/dao/current_user_info_dao.py
+18
-4
product_auth.py
unify_api/modules/users/views/product_auth.py
+5
-13
No files found.
unify_api/modules/users/dao/current_user_info_dao.py
View file @
b5a2ec41
...
...
@@ -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
),))
unify_api/modules/users/views/product_auth.py
View file @
b5a2ec41
...
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment