import { NextRequest, NextResponse } from 'next/server'; import { getServerSession } from 'next-auth'; import { authOptions } from '@/lib/auth'; import { isSuperAdmin } from '@/lib/department-permission'; // GET - 检查当前用户是否是超级管理员 export async function GET(request: NextRequest) { try { const session = await getServerSession(authOptions); const userId = (session?.user as any)?.id; if (!session || !userId) { return NextResponse.json({ isSuperAdmin: false }); } const result = await isSuperAdmin(userId); return NextResponse.json({ isSuperAdmin: result }); } catch (error) { console.error('Check super admin error:', error); return NextResponse.json({ isSuperAdmin: false }); } }