剪辑台查询视频补全视频根据项目以及剧本

This commit is contained in:
小帅 2026-04-06 18:53:27 +08:00
parent 45c04bd729
commit 300e6b4b25
2 changed files with 22 additions and 3 deletions

View File

@ -10,14 +10,16 @@ export default router.post(
"/", "/",
validateFields({ validateFields({
projectId: z.number(), projectId: z.number(),
scriptId: z.number().optional(),
}), }),
async (req, res) => { async (req, res) => {
const { projectId } = req.body; const { projectId, scriptId } = req.body;
const list = await u const list = await u
.db("o_assets") .db("o_assets")
.leftJoin("o_image", "o_assets.id", "=", "o_image.assetsId") .leftJoin("o_image", "o_assets.id", "=", "o_image.assetsId")
.where("o_assets.type", "clip") .where("o_assets.type", "clip")
.andWhere("projectId", projectId) .andWhere("projectId", projectId)
.andWhere("scriptId", scriptId)
.select("*"); .select("*");
const data = await Promise.all( const data = await Promise.all(
list.map(async (item) => ({ list.map(async (item) => ({
@ -34,7 +36,7 @@ export default router.post(
type: "clip", type: "clip",
}); });
// 查询o_video表 // 查询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( const video = await Promise.all(
videoRows.map(async (row) => ({ videoRows.map(async (row) => ({

View File

@ -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 { export interface memories {
'content': string; 'content': string;
'createTime': number; 'createTime': number;
@ -231,6 +247,7 @@ export interface o_videoTrack {
} }
export interface DB { export interface DB {
"_o_project_old_20260404": _o_project_old_20260404;
"memories": memories; "memories": memories;
"o_agentDeploy": o_agentDeploy; "o_agentDeploy": o_agentDeploy;
"o_agentWorkData": o_agentWorkData; "o_agentWorkData": o_agentWorkData;