// GET /api/status — 所有服务实时状态摘要 import { NextResponse } from 'next/server' import { dbQuery } from '@/lib/db' export async function GET() { const services = dbQuery('SELECT id, name, category, alert_level, current_status, status_since FROM services WHERE enabled = 1 ORDER BY display_order, id') const counts = { normal: 0, abnormal: 0, unknown: 0 } services.forEach((s: Record) => { const st = String(s.current_status); if (st === 'normal') counts.normal++; else if (st === 'abnormal') counts.abnormal++; else counts.unknown++ }) return NextResponse.json({ services, counts, timestamp: new Date().toISOString() }) }