Commit e8e4ca77 authored by ZZH's avatar ZZH

client login add lang field 2024-06-17

parent 0604c99b
......@@ -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):
......
......@@ -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)
......
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