import { NextRequest, NextResponse } from 'next/server' import { UserService } from '@/lib/services/database-service' const userService = new UserService() export async function GET( request: NextRequest, { params }: { params: Promise<{ id: string }> } ) { try { const { id: userId } = await params if (!userId) { return NextResponse.json( { success: false, error: '用戶 ID 是必需的' }, { status: 400 } ) } const stats = await userService.getUserDetailedStats(userId) return NextResponse.json({ success: true, data: stats }) } catch (error) { console.error('獲取用戶統計數據錯誤:', error) return NextResponse.json( { success: false, error: '獲取用戶統計數據時發生錯誤' }, { status: 500 } ) } }