From aeb297efcf50954d331b535b6e93288141af1f2d Mon Sep 17 00:00:00 2001 From: jxxghp Date: Tue, 19 Aug 2025 11:23:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=AB=99=E7=82=B9=E6=BF=80?= =?UTF-8?q?=E6=B4=BB=E7=8A=B6=E6=80=81=E7=9A=84=E5=88=A4=E6=96=AD=E9=80=BB?= =?UTF-8?q?=E8=BE=91=EF=BC=8C=E7=AE=80=E5=8C=96=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/chain/site.py | 2 +- app/db/models/site.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/chain/site.py b/app/chain/site.py index 9282dd5c..23e0369f 100644 --- a/app/chain/site.py +++ b/app/chain/site.py @@ -317,7 +317,7 @@ class SiteChain(ChainBase): indexer = siteshelper.get_indexer(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) # 更新站点Cookie diff --git a/app/db/models/site.py b/app/db/models/site.py index 26946eae..cbfc3bc7 100644 --- a/app/db/models/site.py +++ b/app/db/models/site.py @@ -69,12 +69,12 @@ class Site(Base): @classmethod @db_query 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 @async_db_query 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() @classmethod