全项目扫描修复: Docker数据卷修复+安全requireAdmin+12页SEO+API白名单+脚本超时+常量提取+假数据删除
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import { PrismaClient } from "@prisma/client";
|
||||
import { PrismaMariaDb } from "@prisma/adapter-mariadb";
|
||||
import "dotenv/config";
|
||||
|
||||
const base = process.env.DATABASE_URL.replace("mysql://", "mariadb://");
|
||||
const cs = base + (base.includes("?") ? "&" : "?") + "connection_limit=5";
|
||||
const prisma = new PrismaClient({ adapter: new PrismaMariaDb(cs) });
|
||||
|
||||
// 列出所有父板块(parentId=null)
|
||||
const parents = await prisma.forumCategory.findMany({
|
||||
where: { parentId: null },
|
||||
orderBy: { sortOrder: "asc" }
|
||||
});
|
||||
console.log("=== 父板块(parentId=null) ===");
|
||||
for (const p of parents) {
|
||||
const childCount = await prisma.forumCategory.count({ where: { parentId: p.id } });
|
||||
const topicCount = await prisma.forumTopic.count({ where: { categoryId: p.id } });
|
||||
console.log(` [${p.id}] ${p.slug} - ${p.name} (子板块:${childCount} 话题:${topicCount})`);
|
||||
}
|
||||
|
||||
// 列出所有"ec-platform"类的新设计子板块
|
||||
const newSlugs = ["ec-platform", "ec-livestream", "ai-tools-app", "ai-llm", "fi-stock", "re-residential", "fd-restaurant", "ll-beauty", "hl-cosmetic", "edu-k12"];
|
||||
console.log("\n=== 新设计子板块状态 ===");
|
||||
for (const slug of newSlugs) {
|
||||
const c = await prisma.forumCategory.findUnique({ where: { slug } });
|
||||
if (c) {
|
||||
console.log(` ✓ ${slug} - ${c.name} | parentId=${c.parentId} | topics=${c.topicCount}`);
|
||||
} else {
|
||||
console.log(` ✗ ${slug} 不存在`);
|
||||
}
|
||||
}
|
||||
|
||||
await prisma.$disconnect();
|
||||
Reference in New Issue
Block a user