25 lines
693 B
TypeScript
25 lines
693 B
TypeScript
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 })
|
|
}
|
|
}
|