From 191be9c5fd7fb8aeff800e14a15b50000925f624 Mon Sep 17 00:00:00 2001 From: "2569718930@qq.com" <2569718930@qq.com> Date: Tue, 12 May 2026 21:01:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=BA=E5=9C=BA=E6=B8=A9=E5=BA=A6=E5=8F=96?= =?UTF-8?q?=E5=80=BC=E5=A2=9E=E5=8A=A0=20METAR=20=E5=85=9C=E5=BA=95?= =?UTF-8?q?=EF=BC=9A=E9=81=BF=E5=85=8D=E9=AB=98=E9=A2=91=E6=BA=90=E4=B8=8D?= =?UTF-8?q?=E5=8F=AF=E7=94=A8=E6=97=B6=E5=87=BA=E7=8E=B0=E7=A9=BA=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 当 KNMI/FMI/JMA/MGM 数据未就绪时回退到 current.temp, 确保消息至少显示一个温度值而非空白。 Constraint: 兜底温度为 METAR 整数精度,待高频源恢复后自动切回小数 Tested: ruff check 通过 --- src/utils/telegram_push.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/utils/telegram_push.py b/src/utils/telegram_push.py index f7fbcf39..ddd58091 100644 --- a/src/utils/telegram_push.py +++ b/src/utils/telegram_push.py @@ -752,6 +752,10 @@ def _build_airport_status_message( if not airport_row: airport_row = mgm_nearby[0] if mgm_nearby else {} station_temp = airport_row.get("temp") if airport_row else None + # Fallback to city current temp if airport station not found + if station_temp is None: + current = city_weather.get("current") or {} + station_temp = current.get("temp") lines = [header, ""] if runway_pairs and runway_temps and len(runway_pairs) == len(runway_temps):