fix(server): 赛事包导出传入项目名,修复 GET /api/export/project.zip 恒 500

This commit is contained in:
AskaEth committed 2026-09-09 19:57:23 +08:00
1 parent 72462792ec
commit 5ae55b8057
36 files changed
+2672 -108

No files matched your search

+7 -6
View File
@@ -7,6 +7,7 @@ import ConfirmDialog from '../components/ConfirmDialog.vue'
import MockBadge from '../components/system/MockBadge.vue'
import type { IconName } from '../components/icons'
import {
describeError,
projectApi,
resultsExportApi,
rulesApi,
@@ -137,7 +138,7 @@ async function download(kind: ResultExportKind): Promise<void> {
adminApi.client.exports.save(result.data.blob, result.data.filename)
toast.success(`已导出 ${result.data.filename}`, result.mock ? '示例数据:内容为占位文本' : null)
} catch (caught) {
toast.error('导出失败', caught instanceof Error ? caught.message : null)
toast.error('导出失败', describeError(caught))
} finally {
pendingExport.value = null
}
@@ -152,7 +153,7 @@ async function exportProject(): Promise<void> {
adminApi.client.exports.save(result.data.blob, result.data.filename)
toast.success('赛事项目包已导出', result.mock ? '示例数据:内容为占位文本' : '整包拷走即可在另一台机器复现')
} catch (caught) {
projectError.value = caught instanceof Error ? caught.message : '导出失败'
projectError.value = describeError(caught)
} finally {
projectExporting.value = false
}
@@ -206,7 +207,7 @@ async function runProjectImport(): Promise<void> {
projectFile.value = null
if (projectFileInput.value !== null) projectFileInput.value.value = ''
} catch (caught) {
projectError.value = caught instanceof Error ? caught.message : '导入失败'
projectError.value = describeError(caught)
} finally {
projectImporting.value = false
}
@@ -221,7 +222,7 @@ async function exportRules(): Promise<void> {
adminApi.client.exports.save(result.data.blob, result.data.filename)
toast.success('规则包已导出', result.data.filename)
} catch (caught) {
rulesError.value = caught instanceof Error ? caught.message : '导出失败'
rulesError.value = describeError(caught)
} finally {
rulesExporting.value = false
}
@@ -268,7 +269,7 @@ async function previewRules(): Promise<void> {
rulesPreview.value = result.data
} catch (caught) {
rulesPreview.value = null
rulesError.value = caught instanceof Error ? caught.message : '预览失败'
rulesError.value = describeError(caught)
} finally {
rulesPreviewing.value = false
}
@@ -293,7 +294,7 @@ async function applyRules(): Promise<void> {
`已全量重算 ${result.data.recalculatedLedgerRows} 条积分流水`,
)
} catch (caught) {
rulesError.value = caught instanceof Error ? caught.message : '导入失败'
rulesError.value = describeError(caught)
} finally {
rulesApplying.value = false
}