From bf1ee43ffe29248b5d6fd4c048f65c613e000327 Mon Sep 17 00:00:00 2001 From: "2569718930@qq.com" <2569718930@qq.com> Date: Tue, 26 May 2026 11:36:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=B0=E5=8C=97=20Settlement=20=E6=A0=87?= =?UTF-8?q?=E7=AD=BE=E4=BB=8E=20=E8=B7=91=E9=81=93=E5=AE=9E=E6=B5=8B=20?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=20CWA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/app/api/ops/online-users/route.ts | 38 +++++++++++++++++++ .../LiveTemperatureThresholdChart.tsx | 5 ++- 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 frontend/app/api/ops/online-users/route.ts diff --git a/frontend/app/api/ops/online-users/route.ts b/frontend/app/api/ops/online-users/route.ts new file mode 100644 index 00000000..e285c7d0 --- /dev/null +++ b/frontend/app/api/ops/online-users/route.ts @@ -0,0 +1,38 @@ +import { NextRequest, NextResponse } from "next/server"; +import { + applyAuthResponseCookies, + buildBackendRequestHeaders, +} from "@/lib/backend-auth"; +import { buildProxyExceptionResponse } from "@/lib/api-proxy"; + +const API_BASE = process.env.POLYWEATHER_API_BASE_URL; + +export async function GET(req: NextRequest) { + if (!API_BASE) { + return NextResponse.json( + { error: "POLYWEATHER_API_BASE_URL is not configured" }, + { status: 500 }, + ); + } + + try { + const auth = await buildBackendRequestHeaders(req); + const res = await fetch(`${API_BASE}/api/ops/online-users`, { + headers: auth.headers, + cache: "no-store", + }); + const raw = await res.text(); + const response = new NextResponse(raw, { + status: res.status, + headers: { + "Content-Type": res.headers.get("content-type") || "application/json", + "Cache-Control": "no-store", + }, + }); + return applyAuthResponseCookies(response, auth.response); + } catch (error) { + return buildProxyExceptionResponse(error, { + publicMessage: "Failed to fetch online users", + }); + } +} diff --git a/frontend/components/dashboard/scan-terminal/LiveTemperatureThresholdChart.tsx b/frontend/components/dashboard/scan-terminal/LiveTemperatureThresholdChart.tsx index f084298a..453c466b 100644 --- a/frontend/components/dashboard/scan-terminal/LiveTemperatureThresholdChart.tsx +++ b/frontend/components/dashboard/scan-terminal/LiveTemperatureThresholdChart.tsx @@ -1447,10 +1447,11 @@ export function LiveTemperatureThresholdChart({ const isTokyo = normalizedKey === 'tokyo'; const isSingapore = normalizedKey === 'singapore'; const isParis = normalizedKey === 'paris'; + const isTaipei = normalizedKey === 'taipei'; const stationSourceCode = hourly?.airportPrimary?.source_code || (row as any)?.station_source_code || ''; const hasRealStationNetwork = /^(mgm|jma_amedas|fmi|knmi|cowin_obs|ims|ncm|aeroweb|madis_hfmetar|singapore_mss)$/.test(stationSourceCode); const isWeatherStation = !runwaySensorCities.has(normalizedKey) - && !isHKO && !isShenzhen && !isTokyo && !isSingapore && !isParis + && !isHKO && !isShenzhen && !isTokyo && !isSingapore && !isParis && !isTaipei && hasRealStationNetwork; const runwayHeaderLabel = isShenzhen ? '天文台实测 (10分钟)' @@ -1458,6 +1459,7 @@ export function LiveTemperatureThresholdChart({ : isTokyo ? '机场气象站 (10分钟)' : isSingapore ? '航站楼温度' : isParis ? '官方机场观测 (15分钟)' + : isTaipei ? 'CWA (10分钟)' : isWeatherStation ? '气象站实测' : '跑道实测 (1分钟)'; @@ -1469,6 +1471,7 @@ export function LiveTemperatureThresholdChart({ : isTokyo ? '机场气象站' : isSingapore ? '航站楼' : isParis ? '官方机场观测' + : isTaipei ? 'CWA' : isWeatherStation ? '气象站' : '跑道实测';