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("资产已被删除");
}
} catch (e) {
console.errork(e);
await u.db("o_image").where("id", imageId).update({
state: "生成失败",
});

View File

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

View File

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