fix 数据库会话管理

This commit is contained in:
jxxghp
2023-08-16 10:22:45 +08:00
parent b086bbf015
commit da93328d50
29 changed files with 255 additions and 172 deletions

View File

@@ -33,8 +33,11 @@ class DbOper:
_db: Session = None
def __init__(self, _db=SessionLocal()):
self._db = _db
def __init__(self, db: Session = None):
if db:
self._db = db
else:
self._db = SessionLocal()
def __del__(self):
if self._db: