fix: user info api bug
continuous-integration/drone/push Build is passing Details

This commit is contained in:
BryantHe 2023-08-16 16:07:36 +08:00
parent 6ad09ad9fc
commit 916f119d50
2 changed files with 4 additions and 6 deletions

View File

@ -1,10 +1,9 @@
from apiflask import Schema from apiflask import Schema
from apiflask.fields import String, URL, Float from apiflask.fields import String, Float
class UserInfoIn(Schema): class UserInfoIn(Schema):
nickname = String() nickname = String()
avatar_id = String()
height = Float() height = Float()

View File

@ -13,11 +13,10 @@ user = APIBlueprint('user', __name__)
@user.doc(summary='设置用户信息', description='设置用户信息') @user.doc(summary='设置用户信息', description='设置用户信息')
@user.input(UserInfoIn, location='json') @user.input(UserInfoIn, location='json')
@login_required @login_required
def wechat_login(json_data): def set_user_info(json_data):
try: try:
rpc.admin.set_user_info(session['user_id'], rpc.admin.set_user_info(session['user_id'],
json_data.get('nickname', None), json_data.get('nickname', None))
json_data.get('avatar_id', None))
except Exception as e: except Exception as e:
raise UserInfoError(extra_data={'error_docs': str(e)}) raise UserInfoError(extra_data={'error_docs': str(e)})
@ -34,7 +33,7 @@ def wechat_login(json_data):
@user.doc(summary='查询用户信息', description='查询用户信息') @user.doc(summary='查询用户信息', description='查询用户信息')
@user.output(UserInfoOut) @user.output(UserInfoOut)
@login_required @login_required
def refresh_token(): def get_user_info():
result = {} result = {}
try: try:
user_dict = rpc.admin.get_user_info(session['user_id']) user_dict = rpc.admin.get_user_info(session['user_id'])