全项目扫描修复: Docker数据卷修复+安全requireAdmin+12页SEO+API白名单+脚本超时+常量提取+假数据删除

This commit is contained in:
ZhuiGuangAI Dev
2026-06-12 17:27:47 +08:00
parent 464924aea0
commit 4c325c8699
454 changed files with 33647 additions and 980 deletions
+26
View File
@@ -0,0 +1,26 @@
import { prisma } from "@/lib/prisma";
import { NextResponse } from "next/server";
export async function GET(_req: Request, { params }: { params: { id: string } }) {
try {
const userId = parseInt(params.id);
if (isNaN(userId)) {
return NextResponse.json({ error: "无效的用户ID" }, { status: 400 });
}
const comments = await prisma.comment.findMany({
where: { userId, status: "ACTIVE" },
include: {
tool: { select: { name: true, slug: true } },
skill: { select: { name: true, slug: true } },
},
orderBy: { createdAt: "desc" },
take: 30,
});
return NextResponse.json({ comments });
} catch (error: unknown) {
const err = error as { message?: string };
return NextResponse.json({ error: err.message || "获取评价失败" }, { status: 500 });
}
}