mirror of
https://github.com/Lost-MSth/Arcaea-server.git
synced 2026-02-11 10:27:27 +08:00
Fix some bugs
- Fix a bug that `GET` requests without data will report an error in API - Fix a bug that `aggregate` requests will get an error when the inner function raises an error - Fix a bug that the charts of a course cannot be the same because of the incorrect primary keys - Fix a bug that global ranking scores cannot be calculated if there are no chart in the database #61 - The first try to fix #60 (I don't think it can be done so easily.)
This commit is contained in:
@@ -16,7 +16,8 @@ def role_required(request, powers=[]):
|
||||
@wraps(view)
|
||||
def wrapped_view(*args, **kwargs):
|
||||
try:
|
||||
request.json # 检查请求json格式
|
||||
if request.data:
|
||||
request.json # 检查请求json格式
|
||||
except:
|
||||
return error_return(PostError('Payload must be a valid json', api_error_code=-1), 400)
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ from core.sql import Connect
|
||||
from flask import Blueprint, request
|
||||
|
||||
from .api_auth import api_try, request_json_handle, role_required
|
||||
from .api_code import error_return, success_return
|
||||
from .api_code import success_return
|
||||
|
||||
bp = Blueprint('token', __name__, url_prefix='/token')
|
||||
|
||||
@@ -22,9 +22,9 @@ def token_post(data):
|
||||
try:
|
||||
auth_decode = bytes.decode(b64decode(data['auth']))
|
||||
except:
|
||||
return error_return(PostError(api_error_code=-100))
|
||||
raise PostError(api_error_code=-100)
|
||||
if not ':' in auth_decode:
|
||||
return error_return(PostError(api_error_code=-100))
|
||||
raise PostError(api_error_code=-100)
|
||||
name, password = auth_decode.split(':', 1)
|
||||
|
||||
with Connect() as c:
|
||||
|
||||
Reference in New Issue
Block a user