字段名 修改

This commit is contained in:
zhishi 2026-03-24 13:32:28 +08:00
parent 1d674d510d
commit ed9ae23f84
6 changed files with 63 additions and 12 deletions

View File

@ -124,7 +124,7 @@ export default (resTool: ResTool, toolsNames?: string[]) => {
await u.db("o_script_assets").insert(assetId.map((i) => ({ scriptId, assetId: i }))); await u.db("o_script_assets").insert(assetId.map((i) => ({ scriptId, assetId: i })));
} }
socket.emit("setPlanData", { key: "script", value: scriptId });
return true; return true;
}, },
}), }),

View File

@ -28,7 +28,7 @@ export default router.post(
query = query.andWhere("name", "like", `%${name}%`); query = query.andWhere("name", "like", `%${name}%`);
} }
// 分页查询 // 分页查询
const parentAssets = await query.where("o_assets.assetId", null).offset(offset).limit(limit); const parentAssets = await query.where("o_assets.assetsId", null).offset(offset).limit(limit);
// 获取所有子资产供关联使用 // 获取所有子资产供关联使用
let childQuery = u let childQuery = u
@ -37,7 +37,7 @@ export default router.post(
.select("o_assets.*", "o_image.filePath") .select("o_assets.*", "o_image.filePath")
.where("o_assets.projectId", projectId) .where("o_assets.projectId", projectId)
.andWhere("o_assets.type", type) .andWhere("o_assets.type", type)
.whereNotNull("o_assets.assetId"); .whereNotNull("o_assets.assetsId");
if (name) { if (name) {
childQuery = childQuery.andWhere("o_assets.name", "like", `%${name}%`); childQuery = childQuery.andWhere("o_assets.name", "like", `%${name}%`);
} }
@ -47,7 +47,7 @@ export default router.post(
const result = await Promise.all( const result = await Promise.all(
parentAssets.map(async (parent) => ({ parentAssets.map(async (parent) => ({
...parent, ...parent,
sonAssets: childAssets.filter((child) => child.assetId === parent.id), sonAssets: childAssets.filter((child) => child.assetsId === parent.id),
src: parent.filePath && (await u.oss.getFileUrl(parent.filePath!)), src: parent.filePath && (await u.oss.getFileUrl(parent.filePath!)),
})), })),
); );
@ -57,7 +57,7 @@ export default router.post(
.db("o_assets") .db("o_assets")
.where("projectId", projectId) .where("projectId", projectId)
.andWhere("type", type) .andWhere("type", type)
.andWhere("assetId", null) .andWhere("assetsId", null)
.andWhere((qb) => { .andWhere((qb) => {
if (name) { if (name) {
qb.andWhere("name", "like", `%${name}%`); qb.andWhere("name", "like", `%${name}%`);

View File

@ -13,7 +13,7 @@ export default router.post(
}), }),
async (req, res) => { async (req, res) => {
const { projectId } = req.body; const { projectId } = req.body;
const parentAssetsData = await u.db("o_assets").where("projectId", projectId).whereNotNull("assetId"); const parentAssetsData = await u.db("o_assets").where("projectId", projectId).whereNotNull("assetsId");
const parentIds = parentAssetsData.map((i) => i.id); const parentIds = parentAssetsData.map((i) => i.id);
const sonAssetsData = await u.db("o_assets").whereIn("assetsId", parentIds); const sonAssetsData = await u.db("o_assets").whereIn("assetsId", parentIds);
const sonAssetsMap: Record<number, o_assets[]> = {}; const sonAssetsMap: Record<number, o_assets[]> = {};

View File

@ -33,7 +33,7 @@ export default router.post(
.leftJoin("o_image", "o_assets.imageId", "o_image.id") .leftJoin("o_image", "o_assets.imageId", "o_image.id")
.select("o_assets.*", "o_image.filePath") .select("o_assets.*", "o_image.filePath")
.where("o_assets.projectId", projectId) .where("o_assets.projectId", projectId)
.whereNotNull("o_assets.assetId"); .whereNotNull("o_assets.assetsId");
if (!sqlData) { if (!sqlData) {
const flowData: FlowData = { const flowData: FlowData = {
@ -47,7 +47,7 @@ export default router.post(
src: item.filePath && (await u.oss.getFileUrl(item.filePath!)), src: item.filePath && (await u.oss.getFileUrl(item.filePath!)),
derive: await Promise.all( derive: await Promise.all(
childAssetsData childAssetsData
.filter((child) => child.assetId === item.id) .filter((child) => child.assetsId === item.id)
.map(async (child) => ({ .map(async (child) => ({
id: child.id, id: child.id,
assetsId: item.id, assetsId: item.id,

View File

@ -28,7 +28,6 @@ export default router.post(
data.map((i) => i.id), data.map((i) => i.id),
) )
.select("o_assets.id", "o_assets.name", "o_scriptAssets.scriptId"); .select("o_assets.id", "o_assets.name", "o_scriptAssets.scriptId");
console.log("%c Line:23 🍷 assetsData", "background:#ffdd4d", assetsData);
const scriptAssetsMap: Record<number, { id: number; name: string }[]> = {}; const scriptAssetsMap: Record<number, { id: number; name: string }[]> = {};
assetsData.forEach((i) => { assetsData.forEach((i) => {
if (scriptAssetsMap[i.scriptId]) { if (scriptAssetsMap[i.scriptId]) {

View File

@ -1,6 +1,45 @@
// @db-hash f6a9a8164252ce954394431079615459 // @db-hash 25c88b2cb37f9deac8b2bb8354113537
//该文件由脚本自动生成,请勿手动修改 //该文件由脚本自动生成,请勿手动修改
export interface _o_assets_old_20260324 {
'describe'?: string | null;
'id'?: number;
'imageId'?: number | null;
'name'?: string | null;
'projectId'?: number | null;
'prompt'?: string | null;
'remark'?: string | null;
'scriptId'?: number | null;
'sonId'?: number | null;
'startTime'?: number | null;
'state'?: string | null;
'type'?: string | null;
}
export interface _o_assets_old_20260324_1 {
'assetId'?: number | null;
'describe'?: string | null;
'id'?: number;
'imageId'?: number | null;
'name'?: string | null;
'projectId'?: number | null;
'prompt'?: string | null;
'remark'?: string | null;
'scriptId'?: number | null;
'startTime'?: number | null;
'state'?: string | null;
'type'?: string | null;
}
export interface _o_novel_old_20260323 {
'chapter'?: string | null;
'chapterData'?: string | null;
'chapterIndex'?: number | null;
'createTime'?: number | null;
'event'?: string | null;
'eventState'?: number | null;
'id'?: number;
'projectId'?: number | null;
'reel'?: string | null;
}
export interface memories { export interface memories {
'content': string; 'content': string;
'createTime': number; 'createTime': number;
@ -25,7 +64,7 @@ export interface o_agentDeploy {
export interface o_agentWorkData { export interface o_agentWorkData {
'createTime'?: number | null; 'createTime'?: number | null;
'data'?: string | null; 'data'?: string | null;
'episodesId'?: number | null; 'espisodeId'?: number | null;
'id'?: number; 'id'?: number;
'key'?: string | null; 'key'?: string | null;
'projectId'?: number | null; 'projectId'?: number | null;
@ -37,6 +76,7 @@ export interface o_artStyle {
'styles'?: string | null; 'styles'?: string | null;
} }
export interface o_assets { export interface o_assets {
'assetsId'?: number | null;
'describe'?: string | null; 'describe'?: string | null;
'id'?: number; 'id'?: number;
'imageId'?: number | null; 'imageId'?: number | null;
@ -45,7 +85,6 @@ export interface o_assets {
'prompt'?: string | null; 'prompt'?: string | null;
'remark'?: string | null; 'remark'?: string | null;
'scriptId'?: number | null; 'scriptId'?: number | null;
'sonId'?: number | null;
'startTime'?: number | null; 'startTime'?: number | null;
'state'?: string | null; 'state'?: string | null;
'type'?: string | null; 'type'?: string | null;
@ -65,6 +104,15 @@ export interface o_eventChapter {
'id'?: number; 'id'?: number;
'novelId'?: number | null; 'novelId'?: number | null;
} }
export interface o_flowData {
'createTime'?: number | null;
'data'?: string | null;
'espisodeId'?: number | null;
'id'?: number;
'key'?: string | null;
'projectId'?: number | null;
'updateTime'?: number | null;
}
export interface o_image { export interface o_image {
'assetsId'?: number | null; 'assetsId'?: number | null;
'filePath'?: string | null; 'filePath'?: string | null;
@ -196,6 +244,9 @@ export interface o_videoConfig {
} }
export interface DB { export interface DB {
"_o_assets_old_20260324": _o_assets_old_20260324;
"_o_assets_old_20260324_1": _o_assets_old_20260324_1;
"_o_novel_old_20260323": _o_novel_old_20260323;
"memories": memories; "memories": memories;
"o_agentDeploy": o_agentDeploy; "o_agentDeploy": o_agentDeploy;
"o_agentWorkData": o_agentWorkData; "o_agentWorkData": o_agentWorkData;
@ -204,6 +255,7 @@ export interface DB {
"o_assets2Storyboard": o_assets2Storyboard; "o_assets2Storyboard": o_assets2Storyboard;
"o_event": o_event; "o_event": o_event;
"o_eventChapter": o_eventChapter; "o_eventChapter": o_eventChapter;
"o_flowData": o_flowData;
"o_image": o_image; "o_image": o_image;
"o_novel": o_novel; "o_novel": o_novel;
"o_outline": o_outline; "o_outline": o_outline;