feat: add api of body record
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2023-08-12 20:00:38 +08:00
parent 5a83cea081
commit c30c644f7c
7 changed files with 103 additions and 8 deletions

View File

@@ -5,6 +5,8 @@ from functools import wraps
from flask import request, session
from app.api.v1.exception.auth import AuthError
def split_group(dict_list, key):
dict_list.sort(key=itemgetter(key))
@@ -28,12 +30,10 @@ def login_required(f):
def wrapper(*args, **kwargs):
token = request.headers.get("Authorization", default=None)
if not token:
# TODO raise apiflask 的 json 格式的 error
return '请登陆'
raise AuthError()
user_id = rpc.admin.identify(token)
if not user_id:
# TODO raise apiflask 的 json 格式的 error
return '请登陆'
raise AuthError()
session['user_id'] = user_id
return f(*args, **kwargs)
return wrapper