This commit is contained in:
HuangHai
2026-01-21 08:41:47 +08:00
parent 306a3a4127
commit e51dc18d06
40 changed files with 1309 additions and 965 deletions

View File

@@ -53,3 +53,32 @@ class PriceComparisonResponse(BaseModel):
class PriceComparisonSummary(BaseModel):
summary: str
from DbKit.Db import Db
class YltAnalyticsModel:
def __init__(self):
self.db = Db()
async def get_operators_price_trends(self, days: int):
return await self.db.find("YltAnalytics.getOperatorsPriceTrends", {"days": days})
async def list_ylt_stations(self, q: str = None):
params = {}
if q:
params["q"] = True
params["kw"] = f"%{q}%"
return await self.db.find("YltAnalytics.listYltStations", params)
async def fetch_current_stations(self):
return await self.db.find("YltAnalytics.fetchCurrentStations")
async def fetch_station_schedule_json(self, station_hash: str):
rows = await self.db.find("YltAnalytics.fetchStationScheduleJson", {"h": station_hash})
if not rows:
return None
return rows[0].get("schedule_json")
async def fetch_current_station_rows(self, operator: str):
return await self.db.find("YltAnalytics.fetchCurrentStationRows", {"op": operator})