Update to v2.6.6 without release

- Fix a bug about purchase discount
- Fix a bug about database synchronization, which may make 'api_login' table empty
- For Arcaea 3.8.8
- Update a logout api
This commit is contained in:
Lost-MSth
2021-10-22 20:00:22 +08:00
parent a523ff5aae
commit b494b93c14
9 changed files with 33 additions and 13 deletions

View File

@@ -52,9 +52,14 @@ def login(auth: str, ip: str):
return {'token': token, 'user_id': user_id}, 0
def logout():
# 登出接口
pass
def logout(user: User):
# 登出接口,返回错误码
code = 999
with Connect() as c:
c.execute('''delete from api_login where user_id=?''', (user.user_id,))
code = 0
return code
def id_get_role_id(c, user_id):
@@ -119,7 +124,7 @@ def role_required(request, power=[]):
return jsonify({'status': 400, 'code': -1, 'data': {}, 'msg': 'Payload must be a valid json'})
if not 'Token' in request.headers:
return jsonify({'status': 401, 'code': -1, 'data': {}, 'msg': 'No Token'})
return jsonify({'status': 401, 'code': -1, 'data': {}, 'msg': 'No token'})
user = User()
if Config.API_TOKEN == request.headers['Token'] and Config.API_TOKEN != '':
@@ -131,7 +136,7 @@ def role_required(request, power=[]):
user.user_id = api_token_get_id(
c, request.headers['Token'])
if user.user_id is None:
return jsonify({'status': 404, 'code': -1, 'data': {}, 'msg': ''})
return jsonify({'status': 401, 'code': -1, 'data': {}, 'msg': 'No token'})
role_id = id_get_role_id(c, user.user_id)
user.role = role_id_get_role(c, role_id)

View File

@@ -12,7 +12,8 @@ def code_get_msg(code):
'-103': 'Wrong sort parameter',
'-104': 'Wrong sort order parameter',
'-201': 'Wrong username or password',
'-202': 'User is banned'
'-202': 'User is banned',
'-999': 'Unknown error'
}
return msg[str(code)]

View File

@@ -101,7 +101,7 @@ def token_get(user):
@api.api_auth.role_required(request, ['change_me', 'select_me', 'select'])
def token_delete(user):
# 登出
return return_encode()
return return_encode(api.api_auth.logout(user))
@bp.route('/users', methods=['GET'])

Binary file not shown.

View File

@@ -4,7 +4,7 @@ import json
# 数据库初始化文件删掉arcaea_database.db文件后运行即可谨慎使用
ARCAEA_SERVER_VERSION = 'v2.6.5'
ARCAEA_SERVER_VERSION = 'v2.6.6'
def main(path='./'):

View File

@@ -790,4 +790,18 @@
}],
"orig_price": 100,
"price": 100
}, {
"name": "redolentshape",
"items": [{
"type": "single",
"id": "redolentshape",
"is_available": true
}, {
"type": "core",
"amount": 1,
"id": "core_generic",
"is_available": true
}],
"orig_price": 100,
"price": 100
}]

View File

@@ -19,7 +19,7 @@ class Config():
游戏API地址前缀
Game API's URL prefix
'''
GAME_API_PREFIX = '/kusoatui/15'
GAME_API_PREFIX = '/earlgrey/16'
'''
--------------------
'''
@@ -30,7 +30,7 @@ class Config():
Allowed game versions
If it is blank, all are allowed.
'''
ALLOW_APPVERSION = ['3.5.3', '3.5.3c', '3.8.6', '3.8.6c']
ALLOW_APPVERSION = ['3.5.3', '3.5.3c', '3.8.8', '3.8.8c']
'''
--------------------
'''

View File

@@ -777,12 +777,12 @@ def change_purchase():
discount_from = int(time.mktime(time.strptime(
discount_from, "%Y-%m-%dT%H:%M"))) * 1000
else:
discount_from = None
discount_from = -1
if discount_to:
discount_to = int(time.mktime(time.strptime(
discount_to, "%Y-%m-%dT%H:%M"))) * 1000
else:
discount_to = None
discount_to = -1
except:
error = '数据错误 Wrong data.'
flash(error)

View File

@@ -204,7 +204,7 @@ def update_database():
update_one_table(c1, c2, 'user_role')
update_one_table(c1, c2, 'power')
update_one_table(c1, c2, 'role_power')
update_one_table(c1, c2, 'api_auth')
update_one_table(c1, c2, 'api_login')
update_one_table(c1, c2, 'user_char')