fix: 告警说明文档读取问题

This commit is contained in:
TsMask committed 2023-10-24 18:06:07 +08:00
1 parent 78e6ceff63
commit 48ff1b57f7
1 file changed
+4 -3
+4 -3
View File
@@ -20,10 +20,11 @@ export const xlsxUrl = `${
* });
*/
export async function readLoalXlsx(id: string): Promise<Record<string, any>[]> {
let fileBolb = await (await fetch(`${xlsxUrl}/${id}.xlsx`)).arrayBuffer();
if (!fileBolb.byteLength) {
fileBolb = await (await fetch(`${xlsxUrl}/all.xlsx`)).arrayBuffer();
let result = await fetch(`${xlsxUrl}/${id}.xlsx`);
if (result.status !== 200) {
result = await fetch(`${xlsxUrl}/all.xlsx`);
}
const fileBolb = await result.arrayBuffer();
return readSheet(fileBolb, 0);
}