fix: 定时任务修复+管理后台Task7支持 (Task4外键修复, Task7管理员邮箱动态查询, Task5限流防护, Task7加入SCRIPT_MAP)
This commit is contained in:
@@ -3,7 +3,7 @@ import { PrismaMariaDb } from "@prisma/adapter-mariadb";
|
||||
import "dotenv/config";
|
||||
import { withRetry } from "./lib/retry.mjs";
|
||||
|
||||
const base = process.env.DATABASE_URL || "mysql://localhost:3306/zhuiguang_ai?charset=utf8mb4";
|
||||
const base = (process.env.DATABASE_URL || "mysql://localhost:3306/zhuiguang_ai?charset=utf8mb4").replace("mysql://", "mariadb://");
|
||||
const sep = base.includes("?") ? "&" : "?";
|
||||
const connectionString = `${base}${sep}connection_limit=20&pool_timeout=30`;
|
||||
const adapter = new PrismaMariaDb(connectionString);
|
||||
@@ -53,8 +53,10 @@ async function main() {
|
||||
});
|
||||
const pendingTools = await prisma.pendingTool.findMany({
|
||||
where: { status: "pending" },
|
||||
select: { id: true, name: true, websiteUrl: true, logoUrl: true, checkWebsiteOk: true, checkLogoOk: true },
|
||||
select: { id: true, name: true, websiteUrl: true, logoUrl: true, checkWebsiteOk: true, checkLogoOk: true, categoryId: true },
|
||||
});
|
||||
const firstCategory = await prisma.category.findFirst({ select: { id: true } });
|
||||
const defaultCategoryId = firstCategory?.id || 1;
|
||||
|
||||
console.log(` 已发布工具: ${tools.length}, 待审核: ${pendingTools.length}`);
|
||||
|
||||
@@ -107,7 +109,7 @@ async function main() {
|
||||
data: {
|
||||
name: pt.name,
|
||||
slug,
|
||||
categoryId: pt.categoryId || 1,
|
||||
categoryId: pt.categoryId || defaultCategoryId,
|
||||
description: pt.description || "",
|
||||
logoUrl: pt.logoUrl,
|
||||
websiteUrl: pt.websiteUrl || "",
|
||||
|
||||
Reference in New Issue
Block a user