no message

This commit is contained in:
小帅 2026-03-23 18:33:18 +08:00
parent 88add639f4
commit 4decb7a7c7
3 changed files with 39 additions and 10 deletions

View File

@ -4,17 +4,49 @@ import { z } from "zod";
import { success } from "@/lib/responseFormat";
import { validateFields } from "@/middleware/middleware";
const router = express.Router();
import compressing from "compressing";
import { flowDataSchema } from "@/agents/productionAgent/tools";
import path from "path";
import getPath from "@/utils/getPath";
export default router.post(
"/",
validateFields({
projectId: z.number(),
episodesId: z.number(),
data: flowDataSchema,
shotId: z.array(
z.object({
id: z.string(),
}),
),
}),
async (req, res) => {
const { projectId, episodesId } = req.body;
return res.status(200).send(success());
const { shotId } = req.body;
const id = shotId.map((item: { id: string }) => item.id);
const data = await u.db("o_storyboard").whereIn("id", id);
const result = await Promise.all(
data.map(async (item) => {
const url = await u.oss.getFileUrl(item.filePath!);
return { ...item, url };
}),
);
const zipStream = new compressing.zip.Stream();
result.forEach((item) => {
const ext = (item.filePath?.split(".").pop() || "png").toLowerCase();
const absPath = path.join(getPath("oss"), item.filePath!);
zipStream.addEntry(absPath, { relativePath: `${item.title}.${ext}` });
});
const fileName = `分镜.zip`;
const zipFilePath = getPath(["oss", "temp", fileName]);
await new Promise<void>((resolve, reject) => {
const fs = require("fs");
fs.mkdirSync(getPath(["oss", "temp"]), { recursive: true });
const writeStream = fs.createWriteStream(zipFilePath);
zipStream.pipe(writeStream);
writeStream.on("finish", resolve);
writeStream.on("error", reject);
});
const downloadUrl = `${process.env.OSSURL || "http://127.0.0.1:10588/"}temp/${fileName}`;
res.json(success({ url: downloadUrl }));
},
);

View File

@ -13,8 +13,7 @@ export default router.post(
}),
async (req, res) => {
const { scriptId, specifyIds } = req.body;
console.log("%c Line:16 🍡", "background:#465975");
const data = await u.db("o_video").where("scriptId", scriptId).whereIn("id", specifyIds).select("*");
const data = await u.db("o_video").where("scriptId", scriptId).whereIn("id", specifyIds).andWhere("state", "生成中").select("*");
res.status(200).send(success(data));
},
);

View File

@ -1,4 +1,4 @@
// @db-hash 3cdc2f747dac456ddd4bbfd877efe991
// @db-hash 56071dcf512e84c37ffd555806af7162
//该文件由脚本自动生成,请勿手动修改
export interface memories {
@ -79,8 +79,6 @@ export interface o_novel {
'chapterData'?: string | null;
'chapterIndex'?: number | null;
'createTime'?: number | null;
'event'?: string | null;
'eventState'?: number | null;
'id'?: number;
'projectId'?: number | null;
'reel'?: string | null;