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
722200d4
Commit
722200d4
authored
Jun 19, 2024
by
ZZH
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix login mutil lang 2024-06-19
parent
e1ab4310
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
2 deletions
+15
-2
multi_lang.py
unify_api/modules/common/procedures/multi_lang.py
+13
-0
current_user_info.py
unify_api/modules/users/views/current_user_info.py
+2
-2
No files found.
unify_api/modules/common/procedures/multi_lang.py
View file @
722200d4
...
...
@@ -4,12 +4,25 @@ DATE:2024/5/30 11:34
"""
from
pot_libs.logger
import
log
from
unify_api.modules.users.procedures.jwt_user
import
jwt_user
from
unify_api.modules.common.dao.common_dao
import
load_user_lang
from
unify_api.constants
import
(
E_TYPE_MSG_LANG
,
PHASE_LINE_LANG
,
E_TYPE_NAME_LANG
,
LOG_IN_TIPS
,
PRODUCT_INFOS
,
PRODUCT_NAME
)
async
def
parse_user_lang
(
request
):
lang
=
"zh_CN"
try
:
lang
=
request
.
args
.
get
(
"lang"
)
except
Exception
as
e
:
user_id
=
jwt_user
(
request
)
lang
=
await
load_user_lang
(
user_id
)
finally
:
return
lang
def
load_event_msg
(
e_type
,
event_param
,
lang
):
if
not
event_param
:
return
""
...
...
unify_api/modules/users/views/current_user_info.py
View file @
722200d4
...
...
@@ -22,6 +22,7 @@ from unify_api.modules.common.procedures.multi_lang import (
)
from
unify_api.modules.users.procedures.jwt_user
import
auth_phone_verify
,
\
check_password
from
unify_api.modules.common.procedures.multi_lang
import
parse_user_lang
AUTH_EXP
=
300
# redis缓存时间
VALIDATION_EXP
=
60
# 发送验证码间隔时间
...
...
@@ -96,8 +97,7 @@ async def get_user_info(request) -> UserInfoResponse:
@
summary
(
"发送手机验证码"
)
async
def
get_send_sms
(
request
):
phone
=
request
.
args
.
get
(
"phone"
)
user_id
=
jwt_user
(
request
)
lang
=
await
load_user_lang
(
user_id
)
lang
=
await
parse_user_lang
(
request
)
if
re
.
match
(
r'^1[3-9]\d{9}$'
,
phone
):
send_flag
=
await
RedisUtils
()
.
get
(
f
"sms:send_sms_flag_{phone}"
)
if
send_flag
:
...
...
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