From e80faa60105d31ea9d1c9531887eaafa2ecdf05e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=B8=85?= <2944435683> Date: Thu, 9 Apr 2026 15:30:00 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E7=B4=A0=E6=9D=90=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E8=A7=86=E9=A2=91=E8=B0=83=E6=95=B4=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/routes/assets/getMaterialData.ts | 31 +++++++++++++++++------- src/types/database.d.ts | 36 +++++++++++++++++++++++++++- 2 files changed, 57 insertions(+), 10 deletions(-) diff --git a/src/routes/assets/getMaterialData.ts b/src/routes/assets/getMaterialData.ts index e269bd8..1e5e3ba 100644 --- a/src/routes/assets/getMaterialData.ts +++ b/src/routes/assets/getMaterialData.ts @@ -35,16 +35,29 @@ export default router.post( filePath: ending, type: "clip", }); - // 查询o_video表 - const videoRows = await u.db("o_video").where("state", "生成成功").andWhere("scriptId", scriptId).andWhere("projectId", projectId).select("*"); - // 处理并返回结果 + // 查询视频轨道 + const trackRows = await u + .db("o_videoTrack") + .where("o_videoTrack.scriptId", scriptId) + .andWhere("o_videoTrack.projectId", projectId) + .select("o_videoTrack.id as trackId"); + // 按轨道分组处理视频 const video = await Promise.all( - videoRows.map(async (row) => ({ - id: row.id, - filePath: row.filePath ? await u.oss.getFileUrl(row.filePath) : "", - videoTrackId: row.videoTrackId, - })), - ); + trackRows.map(async (track) => { + const videoItems = await u.db("o_video").where("o_video.videoTrackId", track.trackId).andWhere("o_video.state", "生成成功").select("*"); + const videoList = await Promise.all( + videoItems.map(async (v) => ({ + id: v.id, + filePath: v.filePath ? await u.oss.getFileUrl(v.filePath) : "", + videoTrackId: v.videoTrackId, + })), + ); + return { + id: track.trackId, + video: videoList, + }; + }), + ).then((tracks) => tracks.filter((track) => track.video.length > 0)); res.status(200).send(success({ data, video })); }, diff --git a/src/types/database.d.ts b/src/types/database.d.ts index 2a9745d..8adea86 100644 --- a/src/types/database.d.ts +++ b/src/types/database.d.ts @@ -1,6 +1,37 @@ -// @db-hash 3296433eb24314b094ac5d3839c049c5 +// @db-hash 6cd709d9bdfe00c4dc87961a8ebba149 //该文件由脚本自动生成,请勿手动修改 +export interface _o_project_old_20260404 { + 'artStyle'?: string | null; + 'createTime'?: number | null; + 'directorManual'?: string | null; + 'id'?: number | null; + 'imageModel'?: string | null; + 'imageQuality'?: string | null; + 'intro'?: string | null; + 'mode'?: string | null; + 'name'?: string | null; + 'projectType'?: string | null; + 'type'?: string | null; + 'userId'?: number | null; + 'videoModel'?: string | null; + 'videoRatio'?: string | null; +} +export interface _o_prompt_old_20260406 { + 'data'?: string | null; + 'id'?: number; + 'name'?: string | null; + 'type'?: string | null; + 'useData'?: string | null; +} +export interface _o_prompt_old_20260406_1 { + 'data'?: string | null; + 'id'?: number; + 'name'?: string | null; + 'TEXT'?: any | null; + 'type'?: string | null; + 'useData'?: string | null; +} export interface memories { 'content': string; 'createTime': number; @@ -232,6 +263,9 @@ export interface o_videoTrack { } export interface DB { + "_o_project_old_20260404": _o_project_old_20260404; + "_o_prompt_old_20260406": _o_prompt_old_20260406; + "_o_prompt_old_20260406_1": _o_prompt_old_20260406_1; "memories": memories; "o_agentDeploy": o_agentDeploy; "o_agentWorkData": o_agentWorkData; From 5529e90ce92e47777eca6ee3ae9a379608033a79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=B8=85?= <2944435683> Date: Thu, 9 Apr 2026 16:39:33 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E7=B4=A0=E6=9D=90?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E6=9F=A5=E8=AF=A2=E6=9C=AC=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E5=85=A8=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/routes/assets/getMaterialData.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/routes/assets/getMaterialData.ts b/src/routes/assets/getMaterialData.ts index 1e5e3ba..8c35c07 100644 --- a/src/routes/assets/getMaterialData.ts +++ b/src/routes/assets/getMaterialData.ts @@ -18,8 +18,7 @@ export default router.post( .db("o_assets") .leftJoin("o_image", "o_assets.id", "=", "o_image.assetsId") .where("o_assets.type", "clip") - .andWhere("projectId", projectId) - .andWhere("scriptId", scriptId) + .andWhere("o_assets.projectId", projectId) .select("*"); const data = await Promise.all( list.map(async (item) => ({ @@ -40,7 +39,7 @@ export default router.post( .db("o_videoTrack") .where("o_videoTrack.scriptId", scriptId) .andWhere("o_videoTrack.projectId", projectId) - .select("o_videoTrack.id as trackId"); + .select("o_videoTrack.id as trackId","o_videoTrack.videoId"); // 按轨道分组处理视频 const video = await Promise.all( trackRows.map(async (track) => { @@ -54,6 +53,7 @@ export default router.post( ); return { id: track.trackId, + videoId: track.videoId, video: videoList, }; }),