This commit is contained in:
HuangHai
2026-01-18 20:11:51 +08:00
parent 6655e0cc29
commit 219cd5c220
6 changed files with 102 additions and 1 deletions

View File

@@ -166,6 +166,43 @@ async def get_station_list(d, service, max_stations_count=MAX_STATIONS_COUNT):
total_encountered_count -= 1
continue
busy_list = st.get("busy_list") or []
piles = []
if isinstance(busy_list, list):
for bi in busy_list:
if not isinstance(bi, dict):
continue
mode = bi.get("mode") or bi.get("type") or "未知"
idle = bi.get("idle")
total = bi.get("total")
try:
idle_val = int(idle) if idle is not None else 0
except Exception:
idle_val = 0
try:
total_val = int(total) if total is not None else 0
except Exception:
total_val = 0
piles.append(
{
"type": mode,
"total": total_val,
"free": idle_val,
}
)
if piles:
try:
await service.record_station_status(
{
"station_name": station_name,
"piles": piles,
"distance": st.get("distance_text"),
}
)
except Exception as e:
logger.error(f"记录列表页状态失败 ({station_name}): {e}")
current_idx = total_new_processed_count + 1
remaining = max_stations_count - current_idx
logger.info(f"--- [进度: {current_idx}/{max_stations_count}, 剩余: {remaining}] 发现新场站 '{station_name}',开始处理... ---")