From 4e59c41c813345ccd6b6c9e1171a3903a7e20c26 Mon Sep 17 00:00:00 2001 From: "2569718930@qq.com" <2569718930@qq.com> Date: Wed, 20 May 2026 17:35:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20ops=20API=20=E4=BB=A3?= =?UTF-8?q?=E7=90=86=E8=B7=AF=E7=94=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/api/ops/telegram/members-audit/route.ts | 16 ++++++++++++++++ frontend/app/api/ops/training/accuracy/route.ts | 16 ++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 frontend/app/api/ops/telegram/members-audit/route.ts create mode 100644 frontend/app/api/ops/training/accuracy/route.ts diff --git a/frontend/app/api/ops/telegram/members-audit/route.ts b/frontend/app/api/ops/telegram/members-audit/route.ts new file mode 100644 index 00000000..12c29056 --- /dev/null +++ b/frontend/app/api/ops/telegram/members-audit/route.ts @@ -0,0 +1,16 @@ +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: "API_BASE not configured" }, { status: 500 }); + try { + const auth = await buildBackendRequestHeaders(req); + const res = await fetch(`${API_BASE}/api/ops/telegram/members-audit`, { headers: auth.headers, cache: "no-store" }); + const raw = await res.text(); + const response = new NextResponse(raw, { status: res.status, headers: { "Content-Type": "application/json", "Cache-Control": "no-store" } }); + return applyAuthResponseCookies(response, auth.response); + } catch (e) { return buildProxyExceptionResponse(e, { publicMessage: "Telegram audit failed" }); } +} diff --git a/frontend/app/api/ops/training/accuracy/route.ts b/frontend/app/api/ops/training/accuracy/route.ts new file mode 100644 index 00000000..ca23fc44 --- /dev/null +++ b/frontend/app/api/ops/training/accuracy/route.ts @@ -0,0 +1,16 @@ +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: "API_BASE not configured" }, { status: 500 }); + try { + const auth = await buildBackendRequestHeaders(req); + const res = await fetch(`${API_BASE}/api/ops/training/accuracy`, { headers: auth.headers, cache: "no-store" }); + const raw = await res.text(); + const response = new NextResponse(raw, { status: res.status, headers: { "Content-Type": "application/json", "Cache-Control": "no-store" } }); + return applyAuthResponseCookies(response, auth.response); + } catch (e) { return buildProxyExceptionResponse(e, { publicMessage: "Training accuracy fetch failed" }); } +}