2026-05-25: 等级体系升级(20级)+论坛二级分类+会员空间

This commit is contained in:
ZhuiGuangAI Dev
2026-05-24 23:05:38 +08:00
parent 6c78c32157
commit 9bf3e7574a
118 changed files with 11842 additions and 3262 deletions
@@ -3,6 +3,30 @@ import { getServerSession } from "next-auth";
import { authOptions } from "@/lib/auth";
import { NextResponse } from "next/server";
export async function GET(
_request: Request,
{ params }: { params: { id: string } }
) {
const session = await getServerSession(authOptions);
if (!session?.user?.id) {
return NextResponse.json({ error: "请先登录" }, { status: 401 });
}
const collectionId = parseInt(params.id);
const userId = parseInt(session.user.id);
const collection = await prisma.collection.findUnique({
where: { id: collectionId },
include: { _count: { select: { items: true } } },
});
if (!collection || collection.userId !== userId) {
return NextResponse.json({ error: "收藏夹不存在或无权限" }, { status: 403 });
}
return NextResponse.json(collection);
}
export async function PUT(
request: Request,
{ params }: { params: { id: string } }