Ready to update to v2.5

Please wait for some time. I need to change readme. I almost forgot what I changed before.
WARNING: There will be many bugs!
This commit is contained in:
Lost-MSth
2021-06-10 19:01:26 +08:00
parent 8a3cec05b7
commit 3fbf473de2
27 changed files with 1690 additions and 662 deletions

View File

@@ -89,11 +89,10 @@ def role_required(request, power=[]):
return jsonify({'status': 401, 'code': -1, 'data': {}, 'msg': 'No Token'})
user = User()
if power == []:
if Config.API_TOKEN == request.headers['Token'] and Config.API_TOKEN != '':
user.user_id = 0
else:
return jsonify({'status': 403, 'code': -1, 'data': {}, 'msg': 'No permission'})
if Config.API_TOKEN == request.headers['Token'] and Config.API_TOKEN != '':
user.user_id = 0
elif power == []:
return jsonify({'status': 403, 'code': -1, 'data': {}, 'msg': 'No permission'})
else:
with Connect() as c:
user.user_id = api_token_get_id(

View File

@@ -87,7 +87,7 @@ def users_get(user):
# 查询全用户信息
limit, offset, query, sort, code = get_query_parameter(request, ['user_id', 'name', 'user_code'], [
'user_id', 'name', 'user_code', 'join_date', 'rating_ptt', 'time_played', 'ticket'])
'user_id', 'name', 'user_code', 'join_date', 'rating_ptt', 'time_played', 'ticket', 'world_rank_score'])
if code < 0:
return jsonify({'status': 200, 'code': code, 'data': {}, 'msg': code_get_msg(code)})

View File

@@ -17,14 +17,14 @@ def get_song_info(song_id):
'pakset': x[5],
'artist': x[6],
'date': x[9],
'rating_pst': x[12]/10,
'rating_prs': x[13]/10,
'rating_ftr': x[14]/10,
'rating_byn': x[15]/10,
'difficultly_pst': x[16]/2,
'difficultly_prs': x[17]/2,
'difficultly_ftr': x[18]/2,
'difficultly_byn': x[19]/2
'rating_pst': x[13]/10,
'rating_prs': x[14]/10,
'rating_ftr': x[15]/10,
'rating_byn': x[16]/10,
'difficultly_pst': x[17]/2,
'difficultly_prs': x[18]/2,
'difficultly_ftr': x[19]/2,
'difficultly_byn': x[20]/2
}
return r
@@ -45,14 +45,14 @@ def get_songs(limit=-1, offset=0, query={}, sort=[]):
'pakset': i[5],
'artist': i[6],
'date': i[9],
'rating_pst': i[12]/10,
'rating_prs': i[13]/10,
'rating_ftr': i[14]/10,
'rating_byn': i[15]/10,
'difficultly_pst': i[16]/2,
'difficultly_prs': i[17]/2,
'difficultly_ftr': i[18]/2,
'difficultly_byn': i[19]/2
'rating_pst': i[13]/10,
'rating_prs': i[14]/10,
'rating_ftr': i[15]/10,
'rating_byn': i[16]/10,
'difficultly_pst': i[17]/2,
'difficultly_prs': i[18]/2,
'difficultly_ftr': i[19]/2,
'difficultly_byn': i[20]/2
})
return r