diff --git a/src/routes/production/getFlowData.ts b/src/routes/production/getFlowData.ts index 15a1155..0de1f22 100644 --- a/src/routes/production/getFlowData.ts +++ b/src/routes/production/getFlowData.ts @@ -86,6 +86,7 @@ export default router.post( } else { try { const storyboardData = await u.db("o_storyboard").where("scriptId", episodesId); + await Promise.all( storyboardData.map(async (i) => { if (i.filePath) { diff --git a/src/routes/production/saveFlowData.ts b/src/routes/production/saveFlowData.ts index c48dcb4..c8773eb 100644 --- a/src/routes/production/saveFlowData.ts +++ b/src/routes/production/saveFlowData.ts @@ -25,16 +25,23 @@ export default router.post( } = req.body; const sqlData = await u.db("o_agentWorkData").where("projectId", String(projectId)).andWhere("episodesId", String(episodesId)).first(); const filterDatas = data.storyboard.filter((i) => !i.id); - if (data.storyboard && data.storyboard.length && !filterDatas.length) - await Promise.all( - data.storyboard - .filter((i) => i.id) - .map(async (i, index) => { - await u.db("o_storyboard").where("id", i.id).update({ - index: index, - }); - }), - ); + if (data.storyboard && data.storyboard.length && !filterDatas.length) { + try { + await Promise.all( + data.storyboard + .filter((i) => i.id) + .map(async (i, index) => { + await u.db("o_storyboard").where("id", i.id).update({ + index: index, + }); + }), + ); + } catch (error) { + console.error("更新分镜排序失败", error) + } + } + + if (!sqlData) { await u.db("o_agentWorkData").insert({ projectId, diff --git a/src/routes/production/storyboard/batchAddStoryboardInfo.ts b/src/routes/production/storyboard/batchAddStoryboardInfo.ts index 56f334b..7af2e3e 100644 --- a/src/routes/production/storyboard/batchAddStoryboardInfo.ts +++ b/src/routes/production/storyboard/batchAddStoryboardInfo.ts @@ -32,9 +32,9 @@ export default router.post( state: item.state, scriptId, projectId, - track:item.track, - videoDesc:item.videoDesc, - shouldGenerateImage:item.shouldGenerateImage, + track: item.track, + videoDesc: item.videoDesc, + shouldGenerateImage: item.shouldGenerateImage, createTime: Date.now(), }); if (item.associateAssetsIds?.length) { @@ -100,6 +100,7 @@ export default router.post( state: i.state, scriptId: i.scriptId, reason: i.reason, + videoDesc: i.videoDesc }; }), );