mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-04 23:17:20 +08:00
refactor: 收口 V3 分层架构与插件兼容边界
This commit is contained in:
@@ -91,6 +91,10 @@ class SiteOper(DbOper):
|
||||
"""
|
||||
return await Site.async_list(self._db)
|
||||
|
||||
async def async_list_order_by_pri(self) -> List[Site]:
|
||||
"""异步按优先级获取站点,供站点查询应用服务使用。"""
|
||||
return await Site.async_list_order_by_pri(self._db)
|
||||
|
||||
def list_order_by_pri(self) -> List[Site]:
|
||||
"""
|
||||
获取站点列表
|
||||
@@ -115,6 +119,14 @@ class SiteOper(DbOper):
|
||||
"""
|
||||
Site.delete(self._db, sid)
|
||||
|
||||
def reset(self) -> None:
|
||||
"""清空站点表,保留站点模型细节在数据库适配层。"""
|
||||
Site.reset(self._db)
|
||||
|
||||
async def stage_reset(self) -> None:
|
||||
"""暂存清空站点表,由应用事务统一提交。"""
|
||||
await self._db.execute(sqlalchemy_delete(Site))
|
||||
|
||||
def update(self, sid: int, payload: dict) -> Optional[Site]:
|
||||
"""
|
||||
更新站点
|
||||
@@ -235,6 +247,25 @@ class SiteOper(DbOper):
|
||||
self._db, domain=domain, workdate=workdate
|
||||
)
|
||||
|
||||
async def async_get_userdata_latest(self) -> List[SiteUserData]:
|
||||
"""异步获取各站点最新用户数据。"""
|
||||
return await SiteUserData.async_get_latest(self._db)
|
||||
|
||||
async def async_get_icon_by_domain(self, domain: str) -> Optional[SiteIcon]:
|
||||
"""异步按域名获取站点图标。"""
|
||||
return await SiteIcon.async_get_by_domain(self._db, domain)
|
||||
|
||||
async def async_get_statistic_by_domain(
|
||||
self,
|
||||
domain: str,
|
||||
) -> Optional[SiteStatistic]:
|
||||
"""异步按域名获取站点统计。"""
|
||||
return await SiteStatistic.async_get_by_domain(self._db, domain)
|
||||
|
||||
async def async_list_statistics(self) -> List[SiteStatistic]:
|
||||
"""异步获取所有站点统计。"""
|
||||
return await SiteStatistic.async_list(self._db)
|
||||
|
||||
def get_userdata_by_date(self, date: str) -> List[SiteUserData]:
|
||||
"""
|
||||
获取站点用户数据
|
||||
|
||||
Reference in New Issue
Block a user