diff --git a/src/routes/assets/getMaterialData.ts b/src/routes/assets/getMaterialData.ts index 77a9fa8..e269bd8 100644 --- a/src/routes/assets/getMaterialData.ts +++ b/src/routes/assets/getMaterialData.ts @@ -10,14 +10,16 @@ export default router.post( "/", validateFields({ projectId: z.number(), + scriptId: z.number().optional(), }), async (req, res) => { - const { projectId } = req.body; + const { projectId, scriptId } = req.body; const list = await u .db("o_assets") .leftJoin("o_image", "o_assets.id", "=", "o_image.assetsId") .where("o_assets.type", "clip") .andWhere("projectId", projectId) + .andWhere("scriptId", scriptId) .select("*"); const data = await Promise.all( list.map(async (item) => ({ @@ -34,7 +36,7 @@ export default router.post( type: "clip", }); // 查询o_video表 - const videoRows = await u.db("o_video").where("state", "生成成功").andWhere("projectId", projectId).select("*"); + const videoRows = await u.db("o_video").where("state", "生成成功").andWhere("scriptId", scriptId).andWhere("projectId", projectId).select("*"); // 处理并返回结果 const video = await Promise.all( videoRows.map(async (row) => ({ diff --git a/src/types/database.d.ts b/src/types/database.d.ts index 1af96b9..dc02b6a 100644 --- a/src/types/database.d.ts +++ b/src/types/database.d.ts @@ -1,6 +1,22 @@ -// @db-hash 6fa5017e455bc367c9c902ba574d11b4 +// @db-hash 19c726e36479d905346c772cfa8007ba //该文件由脚本自动生成,请勿手动修改 +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 memories { 'content': string; 'createTime': number; @@ -231,6 +247,7 @@ export interface o_videoTrack { } export interface DB { + "_o_project_old_20260404": _o_project_old_20260404; "memories": memories; "o_agentDeploy": o_agentDeploy; "o_agentWorkData": o_agentWorkData;