fix:角色基础修正
This commit is contained in:
@@ -81,29 +81,33 @@ class Equipments:
|
|||||||
def __init__(self, version='0'):
|
def __init__(self, version='0'):
|
||||||
self.version = version
|
self.version = version
|
||||||
self.engine = get_engine(version)
|
self.engine = get_engine(version)
|
||||||
self.equs: list[Equ] = []
|
try:
|
||||||
self.oaths: list[Oath] = []
|
self.equs: list[Equ] = []
|
||||||
self.oath_dict: dict[str, Oath] = {}
|
self.oaths: list[Oath] = []
|
||||||
# self.stones: list[Equ] = []
|
self.oath_dict: dict[str, Oath] = {}
|
||||||
self.funs = self.init_func()
|
# self.stones: list[Equ] = []
|
||||||
self.equ_dict: dict[str, Equ] = {}
|
self.funs = self.init_func()
|
||||||
# self.stone_dict: dict[str, Equ] = {}
|
self.equ_dict: dict[str, Equ] = {}
|
||||||
self.jades = []
|
# self.stone_dict: dict[str, Equ] = {}
|
||||||
self.enchants = []
|
self.jades = []
|
||||||
self.emblems = []
|
self.enchants = []
|
||||||
self.suits: list[Suit] = []
|
self.emblems = []
|
||||||
self.suit_dict: dict[str, Suit] = {}
|
self.suits: list[Suit] = []
|
||||||
self.suit_id_dict: dict[str, Suit] = {}
|
self.suit_dict: dict[str, Suit] = {}
|
||||||
self.oath_suits: list[OathSuit] = []
|
self.suit_id_dict: dict[str, Suit] = {}
|
||||||
self.oath_suit_dict: dict[str, OathSuit] = {}
|
self.oath_suits: list[OathSuit] = []
|
||||||
self.init_equs()
|
self.oath_suit_dict: dict[str, OathSuit] = {}
|
||||||
self.init_suits()
|
self.init_equs()
|
||||||
self.init_enchants()
|
self.init_suits()
|
||||||
# self.init_stones()
|
self.init_enchants()
|
||||||
self.init_emblem()
|
# self.init_stones()
|
||||||
self.init_jades()
|
self.init_emblem()
|
||||||
self.init_oaths()
|
self.init_jades()
|
||||||
self.init_oath_suits()
|
self.init_oaths()
|
||||||
|
self.init_oath_suits()
|
||||||
|
finally:
|
||||||
|
self.engine.dispose()
|
||||||
|
self.engine = None
|
||||||
|
|
||||||
def init_equs(self):
|
def init_equs(self):
|
||||||
"""从数据库中获取所有装备信息"""
|
"""从数据库中获取所有装备信息"""
|
||||||
|
|||||||
Binary file not shown.
@@ -3,6 +3,7 @@ from pathlib import Path
|
|||||||
import redis
|
import redis
|
||||||
from sqlalchemy import create_engine
|
from sqlalchemy import create_engine
|
||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
|
from sqlalchemy.pool import NullPool
|
||||||
from config.main import config
|
from config.main import config
|
||||||
|
|
||||||
RedisPool = redis.ConnectionPool.from_url(config.REDIS_URL)
|
RedisPool = redis.ConnectionPool.from_url(config.REDIS_URL)
|
||||||
@@ -21,7 +22,11 @@ def get_redis():
|
|||||||
@cache
|
@cache
|
||||||
def get_db_engine(version='0'):
|
def get_db_engine(version='0'):
|
||||||
db_path = BACKEND_DIR / 'dataFiles' / f'dcalc_{version}.db'
|
db_path = BACKEND_DIR / 'dataFiles' / f'dcalc_{version}.db'
|
||||||
return create_engine(f'sqlite:///{db_path}', connect_args={'check_same_thread': False})
|
return create_engine(
|
||||||
|
f'sqlite:///{db_path}',
|
||||||
|
connect_args={'check_same_thread': False},
|
||||||
|
poolclass=NullPool,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_db():
|
def get_db():
|
||||||
|
|||||||
+1
-1
Submodule backend/openapi updated: 79295067f0...97fb4c180e
Reference in New Issue
Block a user