From 209027afb38e4d8a55a2dc6532103584669c2c19 Mon Sep 17 00:00:00 2001 From: "2569718930@qq.com" <2569718930@qq.com> Date: Tue, 12 May 2026 20:35:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=BA=E5=9C=BA=E6=B6=88=E6=81=AF=E5=8A=A0?= =?UTF-8?q?=E8=8B=B1=E6=96=87=E5=9F=8E=E5=B8=82=E5=90=8D=EF=BC=8C=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E7=A7=BB=E5=88=B0=E6=A0=87=E9=A2=98=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 格式变更:英文名 + 中文标签 + 当地时间放第一行, 温度单独一行,更简洁。 Constraint: 跑道对城市(首尔/釜山)同样受益 Tested: pytest 176 passed, ruff check 通过 --- src/utils/telegram_push.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/utils/telegram_push.py b/src/utils/telegram_push.py index 26a9eeb4..9df38223 100644 --- a/src/utils/telegram_push.py +++ b/src/utils/telegram_push.py @@ -732,22 +732,24 @@ def _build_airport_status_message( deb_pred: Optional[float], local_time: str = "", ) -> str: - label = _AIRPORT_CITY_LABEL.get(city, city.title()) + en_name = city.title() + label = _AIRPORT_CITY_LABEL.get(city, en_name) + time_suffix = f" {local_time}" if local_time else "" + header = f"{en_name} {label}{time_suffix}" + amos = city_weather.get("amos") or {} runway_data = (amos.get("runway_obs") or {}) if amos else {} runway_pairs = runway_data.get("runway_pairs") or [] runway_temps = runway_data.get("temperatures") or [] - # Non-AMOS cities: get temp from airport station (stored in mgm_nearby), not METAR mgm_nearby = city_weather.get("mgm_nearby") or [] station_temp = mgm_nearby[0].get("temp") if mgm_nearby else None - lines = [label, ""] + lines = [header, ""] if runway_pairs and runway_temps and len(runway_pairs) == len(runway_temps): for (r1, r2), (t, _d) in zip(runway_pairs, runway_temps): lines.append(f"{r1}/{r2} {t:.1f}°C") elif station_temp is not None: - time_suffix = f" ({local_time})" if local_time else "" - lines.append(f"{station_temp:.1f}°C{time_suffix}") + lines.append(f"{station_temp:.1f}°C") if deb_pred is not None: lines.append(f"DEB 最高 {deb_pred:.1f}°C") return "\n".join(lines)