Files
soul/app/api/orders/route.ts
2026-01-09 11:58:08 +08:00

28 lines
760 B
TypeScript

import { type NextRequest, NextResponse } from "next/server"
export async function GET(request: NextRequest) {
try {
const { searchParams } = new URL(request.url)
const userId = searchParams.get("userId")
if (!userId) {
return NextResponse.json({ code: 400, message: "缺少用户ID" }, { status: 400 })
}
// In production, fetch from database
// For now, return mock data
const orders = []
console.log("[v0] Fetching orders for user:", userId)
return NextResponse.json({
code: 0,
message: "获取成功",
data: orders,
})
} catch (error) {
console.error("[v0] Get orders error:", error)
return NextResponse.json({ code: 500, message: "服务器错误" }, { status: 500 })
}
}