From 9dfb7b91dfe55a1c7b662a1b9f37fdb53eaa7769 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=B8=85?= <2944435683> Date: Mon, 23 Mar 2026 16:20:34 +0800 Subject: [PATCH] no message --- src/routes/assetsGenerate/generateAssets.ts | 1 - src/routes/production/getProductionData.ts | 25 ++++++++++++--------- src/routes/production/getStoryboardData.ts | 10 ++++----- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/routes/assetsGenerate/generateAssets.ts b/src/routes/assetsGenerate/generateAssets.ts index 3dd11f7..3e1001f 100644 --- a/src/routes/assetsGenerate/generateAssets.ts +++ b/src/routes/assetsGenerate/generateAssets.ts @@ -153,7 +153,6 @@ export default router.post( return res.status(500).send("资产已被删除"); } } catch (e) { - console.errork(e); await u.db("o_image").where("id", imageId).update({ state: "生成失败", }); diff --git a/src/routes/production/getProductionData.ts b/src/routes/production/getProductionData.ts index a35754e..68d6dff 100644 --- a/src/routes/production/getProductionData.ts +++ b/src/routes/production/getProductionData.ts @@ -34,23 +34,26 @@ export default router.post( const parsedData = JSON.parse(item.data); const dataWithFilePath = await Promise.all( parsedData.map(async (d: { type: string; id: number }) => { - if (d.type === "assets") { + if (d.type === "assets" && d.id) { const row = await u .db("o_assets") - .where("o_assets.id", item.id) + .where("o_assets.id", d.id) .leftJoin("o_image", "o_assets.imageId", "o_image.id") - .select("o_image.filePath") + .select("o_image.filePath as imageFilePath") .first(); - if (row?.filePath) { - return await u.oss.getFileUrl(row.filePath); - } - } else { - const row = await u.db("o_storyboard").where("id", item.id).select("filePath").first(); - if (row?.filePath) { - return await u.oss.getFileUrl(row.filePath); + if (row?.imageFilePath) { + return await u.oss.getFileUrl(row.imageFilePath); } + return null; } - return d; + if (d.type === "storyboard" && d.id) { + const row = await u.db("o_storyboard").where("id", d.id).select("filePath").first(); + if (row?.filePath) { + return await u.oss.getFileUrl(row.filePath); + } + return null; + } + return null; }), ); return { diff --git a/src/routes/production/getStoryboardData.ts b/src/routes/production/getStoryboardData.ts index bd72762..2e9f0e5 100644 --- a/src/routes/production/getStoryboardData.ts +++ b/src/routes/production/getStoryboardData.ts @@ -8,17 +8,17 @@ const router = express.Router(); export default router.post( "/", validateFields({ - projectId: z.number(), + scriptId: z.number(), }), async (req, res) => { - const { projectId } = req.body; - const storyboardData = await u.db("o_storyboard"); + const { scriptId } = req.body; + const storyboardData = await u.db("o_storyboard").where({ scriptId }); const data = await Promise.all( storyboardData.map(async (i) => { return { ...i, - title: i.name, - src: i.filePath ? await u.oss.getFileUrl(i.filePath!) : "", + title: i.title, + filePath: i.filePath ? await u.oss.getFileUrl(i.filePath!) : "", }; }), );