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:
@@ -367,6 +367,10 @@ func handleCreateVersionGlobal(c *gin.Context) {
|
|||||||
|
|
||||||
type UpdateVersionRequest struct {
|
type UpdateVersionRequest struct {
|
||||||
Version string `json:"version"`
|
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"`
|
UpdateStrategy string `json:"update_strategy"`
|
||||||
UpdateType string `json:"update_type"`
|
UpdateType string `json:"update_type"`
|
||||||
UpdateMethod string `json:"update_method"`
|
UpdateMethod string `json:"update_method"`
|
||||||
@@ -420,6 +424,16 @@ func handleUpdateVersionGlobal(c *gin.Context) {
|
|||||||
if req.Version != "" {
|
if req.Version != "" {
|
||||||
updates["version"] = 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 != "" {
|
if req.UpdateStrategy != "" {
|
||||||
updates["update_strategy"] = req.UpdateStrategy
|
updates["update_strategy"] = req.UpdateStrategy
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -219,6 +219,12 @@ async function handleSubmit() {
|
|||||||
|
|
||||||
const response = await api.put(`/dev/versions/${versionId.value}`, payload)
|
const response = await api.put(`/dev/versions/${versionId.value}`, payload)
|
||||||
console.log('[DEBUG] handleSubmit response:', response)
|
console.log('[DEBUG] handleSubmit response:', response)
|
||||||
|
|
||||||
|
// 更新原始数据为最新保存的数据
|
||||||
|
if (uploadedData.value) {
|
||||||
|
originalUploadedData.value = { ...uploadedData.value }
|
||||||
|
}
|
||||||
|
|
||||||
toast.success(t('admin.versions.createForm.updateSuccess'))
|
toast.success(t('admin.versions.createForm.updateSuccess'))
|
||||||
router.push('/admin/versions')
|
router.push('/admin/versions')
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user