'commit'
This commit is contained in:
@@ -225,8 +225,13 @@ async def get_station_list(d, service, max_stations_count=MAX_STATIONS_COUNT):
|
||||
logger.info(f"VL 识别成功找到 '分时价格' 按钮: {click_pos}")
|
||||
|
||||
if click_pos:
|
||||
d.click(click_pos[0], click_pos[1])
|
||||
await asyncio.sleep(2)
|
||||
click_x, click_y = int(click_pos[0]), int(click_pos[1])
|
||||
bottom_safe_y = int(h * (1 - BOTTOM_SAFE_EXCLUDE_RATIO))
|
||||
if click_y >= bottom_safe_y:
|
||||
logger.warning(f"'分时价格'按钮识别坐标 ({click_x}, {click_y}) 落在底部安全区域 (>= {bottom_safe_y}),为避免误触底部扫码/导航按钮,本次不点击。")
|
||||
else:
|
||||
d.click(click_x, click_y)
|
||||
await asyncio.sleep(2)
|
||||
|
||||
# 检查页面是否真的变化了
|
||||
after_click_path = take_screenshot(d, f"check_{detail_uuid}", save_dir=TEMP_IMAGE_DIR)
|
||||
@@ -328,16 +333,19 @@ async def get_station_list(d, service, max_stations_count=MAX_STATIONS_COUNT):
|
||||
logger.error(f"后台任务异常: {t.exception()}")
|
||||
background_tasks.remove(t)
|
||||
|
||||
if stations and new_stations_processed_in_page == 0:
|
||||
if not stations:
|
||||
no_new_data_count += 1
|
||||
logger.info(f"本页未识别到任何有效场站,连续 {no_new_data_count} 页无有效场站/新数据。")
|
||||
elif new_stations_processed_in_page == 0:
|
||||
no_new_data_count += 1
|
||||
logger.info(f"本页所有场站均已处理过,连续 {no_new_data_count} 页无新数据。")
|
||||
if no_new_data_count >= 5:
|
||||
logger.info("连续 5 页无新数据,判定为已到底,提前结束。")
|
||||
break
|
||||
else:
|
||||
no_new_data_count = 0
|
||||
|
||||
# 5. 列表页翻页滑动
|
||||
if no_new_data_count >= 3:
|
||||
logger.info("连续 3 页无有效场站或无新数据,判定列表已经到底,提前结束滚动。")
|
||||
break
|
||||
|
||||
logger.info("执行翻页滑动...")
|
||||
start_x, start_y = w // 2, int(h * 0.8)
|
||||
end_x, end_y = w // 2, int(h * (0.8 - SCROLL_DISTANCE_RATIO))
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user