fix:移除Oper类静态属性

This commit is contained in:
jxxghp
2025-06-09 08:08:55 +08:00
parent aa039c6c05
commit ea168edb43
4 changed files with 9 additions and 7 deletions
-1
View File
@@ -236,7 +236,6 @@ class DbOper:
""" """
数据库操作基类 数据库操作基类
""" """
_db: Session = None
def __init__(self, db: Session = None): def __init__(self, db: Session = None):
self._db = db self._db = db
+1
View File
@@ -9,3 +9,4 @@ from .transferhistory import TransferHistory
from .user import User from .user import User
from .userconfig import UserConfig from .userconfig import UserConfig
from .workflow import Workflow from .workflow import Workflow
from .userrequest import UserRequest
+4 -3
View File
@@ -8,14 +8,15 @@ from app.utils.singleton import Singleton
class SystemConfigOper(DbOper, metaclass=Singleton): class SystemConfigOper(DbOper, metaclass=Singleton):
# 配置对象 """
__SYSTEMCONF: dict = {} 系统配置管理
"""
def __init__(self): def __init__(self):
""" """
加载配置到内存 加载配置到内存
""" """
super().__init__() super().__init__()
self.__SYSTEMCONF = {}
for item in SystemConfig.list(self._db): for item in SystemConfig.list(self._db):
self.__SYSTEMCONF[item.key] = item.value self.__SYSTEMCONF[item.key] = item.value
+4 -3
View File
@@ -7,14 +7,15 @@ from app.utils.singleton import Singleton
class UserConfigOper(DbOper, metaclass=Singleton): class UserConfigOper(DbOper, metaclass=Singleton):
# 配置缓存 """
__USERCONF: Dict[str, Dict[str, Any]] = {} 用户配置管理
"""
def __init__(self): def __init__(self):
""" """
加载配置到内存 加载配置到内存
""" """
super().__init__() super().__init__()
self.__USERCONF = {}
for item in UserConfig.list(self._db): for item in UserConfig.list(self._db):
self.__set_config_cache(username=item.username, key=item.key, value=item.value) self.__set_config_cache(username=item.username, key=item.key, value=item.value)