优化站点激活状态的判断逻辑,简化数据库查询条件

This commit is contained in:
jxxghp
2025-08-19 11:23:09 +08:00
parent d48c6b98e8
commit aeb297efcf
2 changed files with 3 additions and 3 deletions

View File

@@ -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