fix: save file info when updating version

- Add file_path, file_size, file_hash, entry_file to UpdateVersionRequest
- Update these fields when saving version changes
- Update originalUploadedData after successful save

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-06-01 09:25:39 +08:00
parent 47f1e9fe43
commit 8cb867e65b
2 changed files with 20 additions and 0 deletions
+14
View File
@@ -367,6 +367,10 @@ func handleCreateVersionGlobal(c *gin.Context) {
type UpdateVersionRequest struct {
Version string `json:"version"`
FilePath string `json:"file_path"`
FileSize int64 `json:"file_size"`
FileHash string `json:"file_hash"`
EntryFile string `json:"entry_file"`
UpdateStrategy string `json:"update_strategy"`
UpdateType string `json:"update_type"`
UpdateMethod string `json:"update_method"`
@@ -420,6 +424,16 @@ func handleUpdateVersionGlobal(c *gin.Context) {
if req.Version != "" {
updates["version"] = req.Version
}
if req.FilePath != "" {
updates["file_path"] = req.FilePath
}
if req.FileSize > 0 {
updates["file_size"] = req.FileSize
}
if req.FileHash != "" {
updates["file_hash"] = req.FileHash
}
updates["entry_file"] = req.EntryFile
if req.UpdateStrategy != "" {
updates["update_strategy"] = req.UpdateStrategy
}
@@ -219,6 +219,12 @@ async function handleSubmit() {
const response = await api.put(`/dev/versions/${versionId.value}`, payload)
console.log('[DEBUG] handleSubmit response:', response)
// 更新原始数据为最新保存的数据
if (uploadedData.value) {
originalUploadedData.value = { ...uploadedData.value }
}
toast.success(t('admin.versions.createForm.updateSuccess'))
router.push('/admin/versions')
}