0.3.0.0
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import { NextResponse } from "next/server"
|
||||
import { getServerSession } from "next-auth"
|
||||
import { authOptions } from "@/lib/auth"
|
||||
import { prisma } from "@/lib/prisma"
|
||||
|
||||
export async function PATCH() {
|
||||
try {
|
||||
const session = await getServerSession(authOptions)
|
||||
|
||||
if (!session?.user?.id) {
|
||||
return NextResponse.json({ error: "未授权" }, { status: 401 })
|
||||
}
|
||||
|
||||
await prisma.user.update({
|
||||
where: { id: session.user.id },
|
||||
data: { hasSeenHelp: true },
|
||||
})
|
||||
|
||||
return NextResponse.json({ success: true })
|
||||
} catch (error) {
|
||||
console.error("更新使用帮助标记失败:", error)
|
||||
return NextResponse.json({ error: "更新失败" }, { status: 500 })
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user