fix db session

This commit is contained in:
jxxghp
2023-09-09 19:26:56 +08:00
parent ccc249f29d
commit 0e36d003c0
16 changed files with 39 additions and 49 deletions

View File

@ -117,9 +117,9 @@ def cookie_cloud_sync(db: Session = Depends(get_db),
清空所有站点数据并重新同步CookieCloud站点信息
"""
Site.reset(db)
SystemConfigOper(db).set(SystemConfigKey.IndexerSites, [])
SystemConfigOper(db).set(SystemConfigKey.RssSites, [])
CookieCloudChain(db).process(manual=True)
SystemConfigOper().set(SystemConfigKey.IndexerSites, [])
SystemConfigOper().set(SystemConfigKey.RssSites, [])
CookieCloudChain().process(manual=True)
# 插件站点删除
EventManager().send_event(EventType.SiteDeleted,
{
@ -203,7 +203,7 @@ def site_resource(site_id: int,
status_code=404,
detail=f"站点 {site_id} 不存在",
)
torrents = TorrentsChain(db).browse(domain=site.domain)
torrents = TorrentsChain().browse(domain=site.domain)
if not torrents:
return []
return [torrent.to_dict() for torrent in torrents]
@ -234,7 +234,7 @@ def read_rss_sites(db: Session = Depends(get_db)) -> List[dict]:
获取站点列表
"""
# 选中的rss站点
rss_sites = SystemConfigOper(db).get(SystemConfigKey.RssSites)
rss_sites = SystemConfigOper().get(SystemConfigKey.RssSites)
# 所有站点
all_site = Site.list_order_by_pri(db)
if not rss_sites or not all_site: