Commit d3b3699e authored by lcn's avatar lcn

调整为公共登录

parent 04552a63
......@@ -119,11 +119,12 @@ async def auth_verify(request):
# 直接将请求转发到auth
resp_str, status = await AioHttpUtils().post(
SETTING.verify_url,
data={},
data={"db": SETTING.mysql_db},
timeout=50,
headers={"Authorization": f"Bearer {token}"}
)
log.info(f"request auth_url resp_str={resp_str} {type(resp_str)} status={status}")
log.info(
f"request auth_url resp_str={resp_str} {type(resp_str)} status={status}")
if status == 200:
payload = ujson.loads(resp_str)
setattr(request.ctx, "user_id", payload["user_id"])
......
......@@ -20,7 +20,8 @@ async def wechat_login(args, host):
"user_info": args.get("user_info"),
"client_name": args.get("client_name"),
"host": host,
"product": args.get("product")
"product": args.get("product"),
"db": SETTING.mysql_db
}
try:
......@@ -45,7 +46,8 @@ async def app_login(args, host):
"client_name": args.get("client_name"),
"unionid": args.get("unionid"),
"host": host,
"product": args.get("product")
"product": args.get("product"),
"db": SETTING.mysql_db
}
if not args.get("unionid"):
return 401, {"code": 40001, "data": None, "message": "unionid is None"}
......@@ -72,6 +74,7 @@ async def web_login(args, host):
"code": args['code'],
"client_name": args.get("client_name"),
"host": host,
"db": SETTING.mysql_db
}
try:
# auth_url = "http://0.0.0.0:9000/unify-api/auth"
......@@ -110,7 +113,8 @@ async def third_login(args, host):
"password": password,
"client_name": args.get("client_name"),
"host": host,
"product": args.get("product")
"product": args.get("product"),
"db": SETTING.mysql_db
}
try:
log.info(
......@@ -148,6 +152,7 @@ async def web_third_login(args, host):
"password": password,
"client_name": args.get("client_name"),
"host": host,
"db": SETTING.mysql_db
}
try:
log.info(
......@@ -197,6 +202,7 @@ async def validation_login(args, host):
"user_id": user["user_id"],
"client_name": client_name,
"host": host,
"db": SETTING.mysql_db
}
try:
log.info(SETTING.auth_url, f"request auth_url={SETTING.auth_url} "
......
......@@ -28,7 +28,7 @@ class AuthView(HTTPMethodView):
resp_str, status_code = await AioHttpUtils().post(
SETTING.auth_url,
{"user_name": "balabala", "password": "balabala",
"client_name": client_name},
"client_name": client_name, "db": SETTING.mysql_db},
timeout=50,
)
print(f"resp_str = {resp_str} status={status_code}")
......
......@@ -152,7 +152,8 @@ async def post_save_userinfo(request, body: SaveUserReq):
"phone": phone,
"client_name": "validation",
"host": request.host,
"user_id": user["user_id"]
"user_id": user["user_id"],
"db": SETTING.mysql_db
}
resp_str, status = await AioHttpUtils().post(
SETTING.auth_url,
......
......@@ -54,8 +54,13 @@ async def get_user_logout(request) -> Success:
# await jwt_utils.store_token_blacklist(token)
try:
log.info(f"request logout_url={SETTING.logout_url}")
resp_str, status = await AioHttpUtils().get(
request_body = {
"db": SETTING.mysql_db
}
resp_str, status = await AioHttpUtils().post(
SETTING.logout_url,
request_body,
timeout=50,
headers={"Authorization": f"Bearer {token}"},
)
log.info(f"request auth_url resp_str={resp_str} status={status}")
......
......@@ -21,7 +21,11 @@ class RefreshView(HTTPMethodView):
status=200)
resp, status_code = await AioHttpUtils().post(
SETTING.refresh_token_url,
{"refresh_token": refresh_token, "client_name": client_name},
{
"refresh_token": refresh_token,
"client_name": client_name,
"db": SETTING.mysql_db
},
timeout=50,
headers={"Authorization": f"Bearer {token}"}
)
......
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