This commit is contained in:
HuangHai
2026-01-12 16:53:43 +08:00
parent 4cef36dc96
commit f263c133b8
7 changed files with 441 additions and 758 deletions

View File

@@ -42,11 +42,11 @@ class XinDianTuService:
async def close_db(self):
await self.db.close()
async def process_station_list_vl(self, vl_image_url, json_metadata, device_info=None) -> list:
async def process_station_list_vl(self, vl_image_url_or_path, json_metadata, device_info=None) -> list:
"""
基于 VL 模式处理场站列表
"""
station_list = await ReadImageKit.parse_vl_image(vl_image_url, json_metadata, device_info=device_info)
station_list = await ReadImageKit.parse_vl_image(vl_image_url_or_path, json_metadata, device_info=device_info)
if not station_list:
return []
@@ -490,6 +490,28 @@ class XinDianTuService:
await session.commit()
logger.info(f" - Station status recorded for: {name} (Piles: {free}/{total}, Price: {current_price})")
async def process_price_detail_data(self, station_name, hourly_schedule) -> bool:
"""
直接保存已处理好的小时段价格数据
"""
if not station_name or not hourly_schedule:
return False
station_hash = self.get_hash(station_name)
now = datetime.now()
async with await self.db.get_session() as session:
schedule_id = self.generate_id()
await self.station_price_schedule_model.save(
session=session,
id=schedule_id,
station_hash=station_hash,
schedule_json=hourly_schedule,
valid_start_time=now
)
await session.commit()
return True
async def process_price_schedule(self, station_name: str, schedule_urls: list, device_info: dict = None):
logger.info(f"\n[Service] Processing Price Schedule for '{station_name}'")