This commit is contained in:
HuangHai
2026-01-14 07:05:03 +08:00
parent e25aa5b756
commit a3347b9340
9 changed files with 14 additions and 66 deletions

View File

@@ -105,6 +105,7 @@ class YiLaiTeCrawler(BaseCrawler):
break
name = station.get('name')
address = station.get('address')
point = station.get('point')
if not name or not point:
@@ -217,7 +218,7 @@ class YiLaiTeCrawler(BaseCrawler):
# --------------------------------------------------
# 启动后台任务处理详情页
task = asyncio.create_task(self.analyze_detail_background(name, detail_shots))
task = asyncio.create_task(self.analyze_detail_background(name, detail_shots, address=address))
background_tasks.append(task)
processed_count += 1
@@ -262,7 +263,7 @@ class YiLaiTeCrawler(BaseCrawler):
return processed_count
async def analyze_detail_background(self, station_name, image_paths):
async def analyze_detail_background(self, station_name, image_paths, address=None):
"""
后台异步分析详情页 (支持多张截图合并)
"""
@@ -298,8 +299,8 @@ class YiLaiTeCrawler(BaseCrawler):
unique_prices.sort(key=lambda x: x.get('start', '00:00'))
if unique_prices:
await self.service.process_price_detail_data(station_name, unique_prices)
logger.info(f"场站 {station_name} 价格分析完成并入库 (记录数: {len(unique_prices)})")
await self.service.process_price_detail_data(station_name, unique_prices, address=address)
logger.info(f"场站 {station_name} 价格分析完成并入库 (记录数: {len(unique_prices)}, 地址: {address})")
else:
logger.warning(f"场站 {station_name} 未识别到价格信息")