From 84e7518b041d5386981f3f5db6ea1e24e99c3d6b Mon Sep 17 00:00:00 2001 From: "2569718930@qq.com" <2569718930@qq.com> Date: Tue, 12 May 2026 20:40:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AE=89=E5=8D=A1=E6=8B=89?= =?UTF-8?q?=E6=B8=A9=E5=BA=A6=E5=8F=96=E5=80=BC=E9=94=99=E8=AF=AF=EF=BC=9A?= =?UTF-8?q?=E7=B2=BE=E7=A1=AE=E5=8C=B9=E9=85=8D=20MGM=2017128=20=E6=9C=BA?= =?UTF-8?q?=E5=9C=BA=E7=AB=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit mgm_nearby 包含安卡拉 26 个站点的混合列表,直接取 [0] 可能拿到非机场站。 改为按 ICAO/istNo 精确匹配 17128,其余城市回退到 [0]。 Constraint: 东京/赫尔辛基/阿姆斯特丹的 mgm_nearby 只有一条,不受影响 Tested: pytest 176 passed, ruff check 通过 --- src/utils/telegram_push.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/utils/telegram_push.py b/src/utils/telegram_push.py index 9df38223..f979d4cb 100644 --- a/src/utils/telegram_push.py +++ b/src/utils/telegram_push.py @@ -742,7 +742,16 @@ def _build_airport_status_message( runway_pairs = runway_data.get("runway_pairs") or [] runway_temps = runway_data.get("temperatures") or [] mgm_nearby = city_weather.get("mgm_nearby") or [] - station_temp = mgm_nearby[0].get("temp") if mgm_nearby else None + # Find the specific airport station, not just any nearby station + airport_icao = HIGH_FREQ_AIRPORT_ICAO.get(city, "") + airport_row = None + for row in mgm_nearby: + if str(row.get("istNo") or "") == airport_icao or str(row.get("icao") or "") == airport_icao: + airport_row = row + break + if not airport_row: + airport_row = mgm_nearby[0] if mgm_nearby else {} + station_temp = airport_row.get("temp") if airport_row else None lines = [header, ""] if runway_pairs and runway_temps and len(runway_pairs) == len(runway_temps):