From c8eed2f31532d66163d1e5b2241d2067ef1982ec Mon Sep 17 00:00:00 2001 From: "2569718930@qq.com" <2569718930@qq.com> Date: Tue, 12 May 2026 21:08:43 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=9F=E4=B8=80=E6=9C=BA=E5=9C=BA=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E6=A8=A1=E6=9D=BF=EF=BC=9A=E8=8B=B1=E6=96=87=E5=90=8D?= =?UTF-8?q?/=E6=9C=BA=E5=9C=BA=20+=20=E5=BD=93=E5=89=8D=E5=AE=9E=E6=B5=8B?= =?UTF-8?q?=20+=20DEB=E9=A2=84=E6=8A=A5=20+=20=E5=AE=9E=E6=B5=8B=E6=9C=80?= =?UTF-8?q?=E9=AB=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 所有城市改为统一三段式: Seoul / Incheon 16:03 当前实测:14.6°C 今日DEB预报最高:18.2°C 今日实测最高:16.5°C(15:30) 首尔/釜山保留跑道对温度展示。 Tested: pytest 176 passed, ruff check 通过 --- src/utils/telegram_push.py | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/utils/telegram_push.py b/src/utils/telegram_push.py index ed9268eb..20d018a1 100644 --- a/src/utils/telegram_push.py +++ b/src/utils/telegram_push.py @@ -723,26 +723,25 @@ def _save_airport_state(state: Dict[str, Any]) -> None: os.replace(tmp, path) -_AIRPORT_CITY_LABEL = {"seoul": "首尔/仁川", "busan": "釜山/金海", "tokyo": "东京/羽田", "ankara": "安卡拉/Esenboğa", "helsinki": "赫尔辛基/Vantaa", "amsterdam": "阿姆斯特丹/Schiphol", "istanbul": "伊斯坦布尔/机场"} - - def _build_airport_status_message( city: str, city_weather: Dict[str, Any], deb_pred: Optional[float], local_time: str = "", ) -> str: + _AIRPORT_EN = {"seoul": "Incheon", "busan": "Gimhae", "tokyo": "Haneda", + "ankara": "Esenboğa", "helsinki": "Vantaa", "amsterdam": "Schiphol", + "istanbul": "Airport"} en_name = city.title() - label = _AIRPORT_CITY_LABEL.get(city, en_name) + ap_name = _AIRPORT_EN.get(city, "") time_suffix = f" {local_time}" if local_time else "" - header = f"{en_name} {label}{time_suffix}" + header = f"{en_name} / {ap_name}{time_suffix}" if ap_name else f"{en_name}{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 [] mgm_nearby = city_weather.get("mgm_nearby") or [] - # 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: @@ -753,7 +752,6 @@ def _build_airport_status_message( airport_row = mgm_nearby[0] if mgm_nearby else {} station_temp = airport_row.get("temp") if airport_row else None current = city_weather.get("current") or {} - # Fallback to city current temp if airport station not found if station_temp is None: station_temp = current.get("temp") @@ -762,15 +760,14 @@ def _build_airport_status_message( 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: - lines.append(f"{station_temp:.1f}°C") - # Today's observed high + lines.append(f"当前实测:{station_temp:.1f}°C") + if deb_pred is not None: + lines.append(f"今日DEB预报最高:{deb_pred:.1f}°C") max_so_far = current.get("max_so_far") max_temp_time = current.get("max_temp_time") if max_so_far is not None: - time_str = f" ({max_temp_time})" if max_temp_time else "" - lines.append(f"日内最高 {max_so_far:.1f}°C{time_str}") - if deb_pred is not None: - lines.append(f"DEB 预测 {deb_pred:.1f}°C") + time_str = f"({max_temp_time})" if max_temp_time else "" + lines.append(f"今日实测最高:{max_so_far:.1f}°C{time_str}") return "\n".join(lines)