增加getRecordAttachments端点

This commit is contained in:
jingrow 2025-08-24 00:07:10 +08:00
parent 852a22a3bf
commit 5d828375fb

View File

@ -306,4 +306,28 @@ export async function getSiteSettings() {
site_name: "Jsite"
};
}
}
}
export async function getRecordAttachments(pagetype, name) {
try {
const response = await axios.get(
`${BACKEND_SERVER_URL}/api/action/jsite.api.v1.get_record_attachments`,
{
params: {
pagetype,
name
}
}
);
const message = response.data.message;
if (message?.error) {
throw new Error(message.error.message || '获取附件失败');
}
return { data: message?.data || [] };
} catch (error) {
console.error(`Error fetching attachments for ${pagetype}/${name}:`, error.message);
return { error: error.message, data: [] };
}
}