mirror of
https://github.com/Lost-MSth/Arcaea-server.git
synced 2026-02-08 08:47:32 +08:00
[Enhance] Recent 30
- Update Recent 30 mechanism. - Alter Recent 30 table structure. Note: 1. This is a TEST version. Maybe there are many bugs. 2. This special version is a line of demarcation.
This commit is contained in:
@@ -8,7 +8,7 @@ from traceback import format_exc
|
||||
|
||||
from core.bundle import BundleParser
|
||||
from core.config_manager import Config
|
||||
from core.constant import ARCAEA_LOG_DATBASE_VERSION, ARCAEA_SERVER_VERSION
|
||||
from core.constant import ARCAEA_DATABASE_VERSION, ARCAEA_LOG_DATBASE_VERSION
|
||||
from core.course import Course
|
||||
from core.download import DownloadList
|
||||
from core.purchase import Purchase
|
||||
@@ -46,7 +46,7 @@ class DatabaseInit:
|
||||
with open(self.sql_path, 'r', encoding='utf-8') as f:
|
||||
self.c.executescript(f.read())
|
||||
self.c.execute('''insert into config values("version", :a);''', {
|
||||
'a': ARCAEA_SERVER_VERSION})
|
||||
'a': ARCAEA_DATABASE_VERSION})
|
||||
|
||||
def character_init(self) -> None:
|
||||
'''初始化搭档信息'''
|
||||
@@ -141,8 +141,7 @@ class DatabaseInit:
|
||||
character_id, is_skill_sealed, is_char_uncapped, is_char_uncapped_override, is_hide_rating, favorite_character, max_stamina_notification_enabled, current_map, ticket, prog_boost, email)
|
||||
values(:user_id, :name, :password, :join_date, :user_code, 0, 0, 0, 0, 0, 0, -1, 0, '', :memories, 0, :email)
|
||||
''', {'user_code': x.user_code, 'user_id': x.user_id, 'join_date': now, 'name': x.name, 'password': '41e5653fc7aeb894026d6bb7b2db7f65902b454945fa8fd65a6327047b5277fb', 'memories': 114514, 'email': x.email})
|
||||
self.c.execute('''insert into recent30(user_id) values(:user_id)''', {
|
||||
'user_id': x.user_id})
|
||||
|
||||
self.c.execute(
|
||||
'''insert into user_role values(?, "admin")''', (x.user_id,))
|
||||
|
||||
@@ -175,7 +174,7 @@ class LogDatabaseInit:
|
||||
with open(self.sql_path, 'r') as f:
|
||||
self.c.executescript(f.read())
|
||||
self.c.execute(
|
||||
'''insert into cache values("version", :a, -1);''', {'a': ARCAEA_SERVER_VERSION})
|
||||
'''insert into cache values("version", :a, -1);''', {'a': ARCAEA_LOG_DATBASE_VERSION})
|
||||
|
||||
def init(self) -> None:
|
||||
with Connect(self.db_path) as c:
|
||||
@@ -270,12 +269,12 @@ class FileChecker:
|
||||
except:
|
||||
x = None
|
||||
# 数据库自动更新,不强求
|
||||
if not x or x[0] != ARCAEA_SERVER_VERSION:
|
||||
if not x or x[0] != ARCAEA_DATABASE_VERSION:
|
||||
self.logger.warning(
|
||||
f'Maybe the file `{db_path}` is an old version. Version: {x[0] if x else "None"}')
|
||||
try:
|
||||
self.logger.info(
|
||||
f'Try to update the file `{db_path}` to version {ARCAEA_SERVER_VERSION}.')
|
||||
f'Try to update the file `{db_path}` to version {ARCAEA_DATABASE_VERSION}.')
|
||||
|
||||
if not os.path.isdir(Config.SQLITE_DATABASE_BACKUP_FOLDER_PATH):
|
||||
os.makedirs(Config.SQLITE_DATABASE_BACKUP_FOLDER_PATH)
|
||||
|
||||
Reference in New Issue
Block a user