素材查询视频调整结构
This commit is contained in:
parent
cacadd94c4
commit
e80faa6010
@ -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 }));
|
||||
},
|
||||
|
||||
36
src/types/database.d.ts
vendored
36
src/types/database.d.ts
vendored
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user