Revert "Fix some bugs"

This reverts commit c51a1b4e85.
This commit is contained in:
Lost-MSth
2021-04-05 13:19:32 +08:00
parent c51a1b4e85
commit 9fd626468e
4 changed files with 906 additions and 954 deletions

View File

@@ -580,10 +580,6 @@ def main():
else: else:
app.logger.info('Complete!') app.logger.info('Complete!')
if Config.SSL_CERT and Config.SSL_KEY:
app.run(Config.HOST, Config.PORT, ssl_context=(
Config.SSL_CERT, Config.SSL_KEY))
else:
app.run(Config.HOST, Config.PORT) app.run(Config.HOST, Config.PORT)

View File

@@ -3,7 +3,6 @@ import time
import json import json
import server.arcworld import server.arcworld
import hashlib import hashlib
from setting import Config
def b2int(x): def b2int(x):
@@ -130,13 +129,9 @@ def arc_score_me(user_id, song_id, difficulty, limit=20):
'user_id': user_id, 'song_id': song_id, 'difficulty': difficulty}) 'user_id': user_id, 'song_id': song_id, 'difficulty': difficulty})
x = c.fetchone() x = c.fetchone()
myrank = int(x[0]) + 1 myrank = int(x[0]) + 1
c.execute('''select count(*) from best_score where song_id=:a and difficulty=:b''',
{'a': song_id, 'b': difficulty})
amount = int(c.fetchone()[0])
if myrank <= 4: # 排名在前4 if myrank <= 4: # 排名在前4
return arc_score_top(song_id, difficulty, limit) return arc_score_top(song_id, difficulty, limit)
elif myrank >= 5 and myrank <= 9999 - limit + 4 and amount >= 10000: # 万名内前面有4个人 elif myrank >= 5 and myrank <= 9999 - limit + 4: # 万名内前面有4个人
c.execute('''select user_id from best_score where song_id = :song_id and difficulty = :difficulty order by score DESC, time_played DESC limit :limit offset :offset''', { c.execute('''select user_id from best_score where song_id = :song_id and difficulty = :difficulty order by score DESC, time_played DESC limit :limit offset :offset''', {
'song_id': song_id, 'difficulty': difficulty, 'limit': limit, 'offset': myrank - 5}) 'song_id': song_id, 'difficulty': difficulty, 'limit': limit, 'offset': myrank - 5})
x = c.fetchall() x = c.fetchall()
@@ -162,17 +157,6 @@ def arc_score_me(user_id, song_id, difficulty, limit=20):
y = get_score(c, user_id, song_id, difficulty) y = get_score(c, user_id, song_id, difficulty)
y['rank'] = -1 y['rank'] = -1
r.append(y) r.append(y)
elif amount - myrank < limit - 5: # 后方人数不足
c.execute('''select user_id from best_score where song_id = :song_id and difficulty = :difficulty order by score DESC, time_played DESC limit :limit offset :offset''', {
'song_id': song_id, 'difficulty': difficulty, 'limit': limit, 'offset': amount - limit})
x = c.fetchall()
if x != []:
rank = amount - limit
for i in x:
rank += 1
y = get_score(c, i[0], song_id, difficulty)
y['rank'] = rank
r.append(y)
else: else:
c.execute('''select user_id from best_score where song_id = :song_id and difficulty = :difficulty order by score DESC, time_played DESC limit :limit offset :offset''', { c.execute('''select user_id from best_score where song_id = :song_id and difficulty = :difficulty order by score DESC, time_played DESC limit :limit offset :offset''', {
'song_id': song_id, 'difficulty': difficulty, 'limit': limit, 'offset': 9998-limit}) 'song_id': song_id, 'difficulty': difficulty, 'limit': limit, 'offset': 9998-limit})
@@ -595,10 +579,10 @@ def arc_all_get(user_id):
scores_data = [] scores_data = []
clearlamps_data = [] clearlamps_data = []
clearedsongs_data = [] clearedsongs_data = []
unlocklist_data = [] # unlocklist_data = []
installid_data = '' installid_data = ''
devicemodelname_data = '' devicemodelname_data = ''
story_data = [] # story_data = []
createdAt = 0 createdAt = 0
with Connect() as c: with Connect() as c:
@@ -610,16 +594,17 @@ def arc_all_get(user_id):
scores_data = json.loads(x[1])[""] scores_data = json.loads(x[1])[""]
clearlamps_data = json.loads(x[2])[""] clearlamps_data = json.loads(x[2])[""]
clearedsongs_data = json.loads(x[3])[""] clearedsongs_data = json.loads(x[3])[""]
unlocklist_data = json.loads(x[4])[""] # unlocklist_data = json.loads(x[4])[""]
installid_data = json.loads(x[5])["val"] installid_data = json.loads(x[5])["val"]
devicemodelname_data = json.loads(x[6])["val"] devicemodelname_data = json.loads(x[6])["val"]
story_data = json.loads(x[7])[""] # story_data = json.loads(x[7])[""]
if x[8]: if x[8]:
createdAt = int(x[8]) createdAt = int(x[8])
if Config.SAVE_FULL_UNLOCK: return {
installid_data = "0fcec8ed-7b62-48e2-9d61-55041a22b123" "user_id": user_id,
story_data = [{ "story": {
"": [{
"ma": 1, "ma": 1,
"mi": 1, "mi": 1,
"c": True, "c": True,
@@ -935,7 +920,16 @@ def arc_all_get(user_id):
"c": True, "c": True,
"r": True "r": True
}] }]
unlocklist_data = [{ },
"devicemodelname": {
"val": devicemodelname_data
},
"installid": {
# installid_data 这里如果不固定可能会导致arcaea以为数据一样而不更新
"val": "0fcec8ed-7b62-48e2-9d61-55041a22b123"
},
"unlocklist": {
"": [{
"unlock_key": "worldvanquisher|2|0", "unlock_key": "worldvanquisher|2|0",
"complete": 1 "complete": 1
}, { }, {
@@ -1515,22 +1509,7 @@ def arc_all_get(user_id):
"unlock_key": "anokumene|1|0", "unlock_key": "anokumene|1|0",
"complete": 1 "complete": 1
}] }]
}, "clearedsongs": {
return {
"user_id": user_id,
"story": {
"": story_data
},
"devicemodelname": {
"val": devicemodelname_data
},
"installid": {
"val": installid_data
},
"unlocklist": {
"": unlocklist_data
},
"clearedsongs": {
"": clearedsongs_data "": clearedsongs_data
}, },
"clearlamps": { "clearlamps": {

View File

@@ -14,19 +14,6 @@ class Config():
-------------------- --------------------
''' '''
'''
--------------------
SSL证书路径
留空则使用HTTP
SSL certificate path
If left blank, use HTTP.
'''
SSL_CERT = '' # *.pem
SSL_KEY = '' # *.key
'''
--------------------
'''
''' '''
-------------------- --------------------
愚人节模式开关 愚人节模式开关
@@ -108,13 +95,3 @@ class Config():
''' '''
-------------------- --------------------
''' '''
'''
--------------------
是否强制使用全解锁云端存档
If forcing full unlocked cloud save is enabled
'''
SAVE_FULL_UNLOCK = True
'''
--------------------
'''