Update to v2.3

This commit is contained in:
Lost-MSth
2021-03-09 13:46:49 +08:00
parent df181f104e
commit 4f66f492fc
18 changed files with 450 additions and 343 deletions

View File

@@ -242,8 +242,9 @@ def get_song_state(x):
return 0
def get_user_ptt(c, user_id) -> int:
# 总ptt计算
def get_user_ptt_float(c, user_id) -> float:
# 总ptt计算,返回浮点数
sumr = 0
c.execute('''select rating from best_score where user_id = :a order by rating DESC limit 30''', {
'a': user_id})
@@ -272,8 +273,13 @@ def get_user_ptt(c, user_id) -> int:
sumr += r30[i]
songs.append(s30[i])
i += 1
return sumr/40
return int(sumr/40*100)
def get_user_ptt(c, user_id) -> int:
# 总ptt计算返回4位整数向下取整
return int(get_user_ptt_float(c, user_id)*100)
def update_recent30(c, user_id, song_id, rating, is_protected):
@@ -333,7 +339,7 @@ def update_recent30(c, user_id, song_id, rating, is_protected):
b.append(x[i+1])
if is_protected:
ptt_pre = get_user_ptt(c, user_id)
ptt_pre = get_user_ptt_float(c, user_id)
a_pre = [x for x in a]
b_pre = [x for x in b]
@@ -346,7 +352,7 @@ def update_recent30(c, user_id, song_id, rating, is_protected):
insert_r30table(c, user_id, a, b)
if is_protected:
ptt = get_user_ptt(c, user_id)
ptt = get_user_ptt_float(c, user_id)
if ptt < ptt_pre:
# 触发保护
if song_id in b_pre:
@@ -898,7 +904,23 @@ def arc_all_get(user_id):
"mi": 6,
"c": True,
"r": True
}]},
}, {
"ma": 8,
"mi": 1,
"c": True,
"r": True
}, {
"ma": 8,
"mi": 2,
"c": True,
"r": True
}, {
"ma": 8,
"mi": 3,
"c": True,
"r": True
}]
},
"devicemodelname": {
"val": devicemodelname_data
},

View File

@@ -198,9 +198,8 @@ def get_value_0(c, user_id):
"stamina": 12,
"world_unlocks": ["scenery_chap1", "scenery_chap2", "scenery_chap3", "scenery_chap4", "scenery_chap5"],
"world_songs": ["babaroque", "shadesoflight", "kanagawa", "lucifer", "anokumene", "ignotus", "rabbitintheblackroom", "qualia", "redandblue", "bookmaker", "darakunosono", "espebranch", "blacklotus", "givemeanightmare", "vividtheory", "onefr", "gekka", "vexaria3", "infinityheaven3", "fairytale3", "goodtek3", "suomi", "rugie", "faintlight", "harutopia", "goodtek", "dreaminattraction", "syro", "diode", "freefall", "grimheart", "blaster", "cyberneciacatharsis", "monochromeprincess", "revixy", "vector", "supernova", "nhelv", "purgatorium3", "dement3", "crossover", "guardina", "axiumcrisis", "worldvanquisher", "sheriruth", "pragmatism", "gloryroad", "etherstrike", "corpssansorganes", "lostdesire", "blrink", "essenceoftwilight", "lapis", "solitarydream", "lumia3", "purpleverse", "moonheart3", "glow", "enchantedlove", "take"],
"singles": get_user_singles(c, user_id), # ["dataerror", "yourvoiceso", "crosssoul", "impurebird", "auxesia", "modelista", "yozakurafubuki", "surrender", "metallicpunisher", "carminescythe", "bethere", "callmyname", "fallensquare", "dropdead", "alexandrite", "astraltale", "phantasia", "empireofwinter", "libertas", "dottodot", "dreadnought", "mirzam", "heavenlycaress", "filament", "avantraze", "battlenoone", "saikyostronger", "izana", "einherjar", "laqryma", "amygdata", "altale", "feelssoright", "scarletcage", "teriqma", "mahoroba", "badtek", "maliciousmischance", "buchigireberserker", "galaxyfriends", "xeraphinite", "xanatos"]
"singles": get_user_singles(c, user_id),
"packs": get_user_packs(c, user_id),
# ["vs", "extend", "dynamix", "prelude", "core", "yugamu", "omatsuri", "zettai", "mirai", "shiawase", "chunithm", "nijuusei", "groovecoaster", "rei", "tonesphere", "lanota"]
"characters": characters,
"cores": [],
"recent_score": get_recent_score(c, user_id),

View File

@@ -1,4 +1,6 @@
import sqlite3
from flask import current_app
import traceback
class Connect():
@@ -22,4 +24,8 @@ class Connect():
self.conn.commit()
self.conn.close()
if exc_type is not None:
current_app.logger.error(
traceback.format_exception(exc_type, exc_val, exc_tb))
return True