Initial commit to prepare for remote overwrite
This commit is contained in:
27
app/api/orders/route.ts
Normal file
27
app/api/orders/route.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
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 })
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user