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
e8e4ca77
Commit
e8e4ca77
authored
Jun 17, 2024
by
ZZH
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
client login add lang field 2024-06-17
parent
0604c99b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
1 deletion
+9
-1
common_dao.py
unify_api/modules/common/dao/common_dao.py
+5
-1
auth.py
unify_api/modules/users/views/auth.py
+4
-0
No files found.
unify_api/modules/common/dao/common_dao.py
View file @
e8e4ca77
...
...
@@ -284,7 +284,11 @@ async def user_by_user_id(user_id):
async
def
load_user_lang
(
user_id
):
async
with
MysqlUtil
()
as
conn
:
sql
=
"SELECT lang FROM user WHERE user_id=
%
s;"
try
:
return
await
conn
.
fetch_value
(
sql
,
(
user_id
,))
except
Exception
as
e
:
log
.
info
(
f
"error user_id:{user_id}, {e}"
)
return
None
async
def
user_by_phone_number
(
phone
):
...
...
unify_api/modules/users/views/auth.py
View file @
e8e4ca77
...
...
@@ -20,6 +20,7 @@ class AuthView(HTTPMethodView):
args
=
request
.
json
log
.
info
(
f
"转发authenticate request.json = {request.json}"
)
client_name
=
args
.
get
(
"client_name"
)
client_lang
=
args
.
get
(
"lang"
)
host
=
request
.
host
if
not
client_name
:
return
response
.
json
({
"code"
:
40001
,
"data"
:
None
,
...
...
@@ -38,6 +39,9 @@ class AuthView(HTTPMethodView):
user_id
=
jwt_user
(
request
)
lang
=
await
load_user_lang
(
user_id
)
if
not
lang
:
lang
=
client_lang
if
client_name
==
"wechat"
:
# 微信登录逻辑
status_code
,
resp_body
=
await
wechat_login
(
args
,
host
)
...
...
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