mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-04 23:17:20 +08:00
优化站点激活状态的判断逻辑,简化数据库查询条件
This commit is contained in:
+1
-1
@@ -317,7 +317,7 @@ class SiteChain(ChainBase):
|
|||||||
indexer = siteshelper.get_indexer(domain)
|
indexer = siteshelper.get_indexer(domain)
|
||||||
# 数据库的站点信息
|
# 数据库的站点信息
|
||||||
site_info = siteoper.get_by_domain(domain)
|
site_info = siteoper.get_by_domain(domain)
|
||||||
if site_info and site_info.is_active == 1:
|
if site_info and site_info.is_active:
|
||||||
# 站点已存在,检查站点连通性
|
# 站点已存在,检查站点连通性
|
||||||
status, msg = self.test(domain)
|
status, msg = self.test(domain)
|
||||||
# 更新站点Cookie
|
# 更新站点Cookie
|
||||||
|
|||||||
@@ -69,12 +69,12 @@ class Site(Base):
|
|||||||
@classmethod
|
@classmethod
|
||||||
@db_query
|
@db_query
|
||||||
def get_actives(cls, db: Session):
|
def get_actives(cls, db: Session):
|
||||||
return db.query(cls).filter(cls.is_active == 1).all()
|
return db.query(cls).filter(cls.is_active).all()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@async_db_query
|
@async_db_query
|
||||||
async def async_get_actives(cls, db: AsyncSession):
|
async def async_get_actives(cls, db: AsyncSession):
|
||||||
result = await db.execute(select(cls).where(cls.is_active == 1))
|
result = await db.execute(select(cls).where(cls.is_active))
|
||||||
return result.scalars().all()
|
return result.scalars().all()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|||||||
Reference in New Issue
Block a user