no message

This commit is contained in:
小帅 2026-03-23 16:20:34 +08:00
parent 380a791da2
commit 9dfb7b91df
3 changed files with 19 additions and 17 deletions

View File

@ -153,7 +153,6 @@ export default router.post(
return res.status(500).send("资产已被删除"); return res.status(500).send("资产已被删除");
} }
} catch (e) { } catch (e) {
console.errork(e);
await u.db("o_image").where("id", imageId).update({ await u.db("o_image").where("id", imageId).update({
state: "生成失败", state: "生成失败",
}); });

View File

@ -34,23 +34,26 @@ export default router.post(
const parsedData = JSON.parse(item.data); const parsedData = JSON.parse(item.data);
const dataWithFilePath = await Promise.all( const dataWithFilePath = await Promise.all(
parsedData.map(async (d: { type: string; id: number }) => { parsedData.map(async (d: { type: string; id: number }) => {
if (d.type === "assets") { if (d.type === "assets" && d.id) {
const row = await u const row = await u
.db("o_assets") .db("o_assets")
.where("o_assets.id", item.id) .where("o_assets.id", d.id)
.leftJoin("o_image", "o_assets.imageId", "o_image.id") .leftJoin("o_image", "o_assets.imageId", "o_image.id")
.select("o_image.filePath") .select("o_image.filePath as imageFilePath")
.first(); .first();
if (row?.filePath) { if (row?.imageFilePath) {
return await u.oss.getFileUrl(row.filePath); return await u.oss.getFileUrl(row.imageFilePath);
}
} else {
const row = await u.db("o_storyboard").where("id", item.id).select("filePath").first();
if (row?.filePath) {
return await u.oss.getFileUrl(row.filePath);
} }
return null;
} }
return d; if (d.type === "storyboard" && d.id) {
const row = await u.db("o_storyboard").where("id", d.id).select("filePath").first();
if (row?.filePath) {
return await u.oss.getFileUrl(row.filePath);
}
return null;
}
return null;
}), }),
); );
return { return {

View File

@ -8,17 +8,17 @@ const router = express.Router();
export default router.post( export default router.post(
"/", "/",
validateFields({ validateFields({
projectId: z.number(), scriptId: z.number(),
}), }),
async (req, res) => { async (req, res) => {
const { projectId } = req.body; const { scriptId } = req.body;
const storyboardData = await u.db("o_storyboard"); const storyboardData = await u.db("o_storyboard").where({ scriptId });
const data = await Promise.all( const data = await Promise.all(
storyboardData.map(async (i) => { storyboardData.map(async (i) => {
return { return {
...i, ...i,
title: i.name, title: i.title,
src: i.filePath ? await u.oss.getFileUrl(i.filePath!) : "", filePath: i.filePath ? await u.oss.getFileUrl(i.filePath!) : "",
}; };
}), }),
); );