fix: 简化检测更新 API 返回数据,移除 files 字段
- 移除 ZIP 包内文件列表的返回,客户端只需要补丁包/完整包信息 - 返回数据更简洁:download_url, file_size, file_hash, patch_url 等 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -99,21 +99,15 @@ func handleAppCheckUpdate(c *gin.Context) {
|
||||
if clientVersion == "" {
|
||||
latestVersion := &allVersions[0]
|
||||
|
||||
// 构建文件列表
|
||||
files := make([]map[string]interface{}, len(latestVersion.Files))
|
||||
for i, f := range latestVersion.Files {
|
||||
files[i] = map[string]interface{}{
|
||||
"file_path": f.FilePath,
|
||||
"file_name": f.FileName,
|
||||
"file_size": f.FileSize,
|
||||
"file_hash": f.FileHash,
|
||||
"file_type": f.FileType,
|
||||
"is_required": f.IsRequired,
|
||||
}
|
||||
}
|
||||
|
||||
// 确定下载地址:优先使用自定义地址
|
||||
downloadURL := latestVersion.FilePath
|
||||
downloadSize := latestVersion.FileSize
|
||||
downloadHash := latestVersion.FileHash
|
||||
if latestVersion.FullPackagePath != "" {
|
||||
downloadURL = latestVersion.FullPackagePath
|
||||
downloadSize = latestVersion.FullPackageSize
|
||||
downloadHash = latestVersion.FullPackageHash
|
||||
}
|
||||
if latestVersion.CustomDownloadURL != "" {
|
||||
downloadURL = latestVersion.CustomDownloadURL
|
||||
}
|
||||
@@ -122,15 +116,14 @@ func handleAppCheckUpdate(c *gin.Context) {
|
||||
"has_update": true,
|
||||
"latest_version": latestVersion.Version,
|
||||
"download_url": downloadURL,
|
||||
"file_size": latestVersion.FileSize,
|
||||
"file_hash": latestVersion.FileHash,
|
||||
"file_size": downloadSize,
|
||||
"file_hash": downloadHash,
|
||||
"entry_file": latestVersion.EntryFile,
|
||||
"update_notes": latestVersion.Description,
|
||||
"update_strategy": latestVersion.UpdateStrategy,
|
||||
"update_type": latestVersion.UpdateType,
|
||||
"update_method": latestVersion.UpdateMethod,
|
||||
"changelog": latestVersion.Changelog,
|
||||
"files": files,
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -203,19 +196,6 @@ func handleAppCheckUpdate(c *gin.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
// 构建文件列表
|
||||
files := make([]map[string]interface{}, len(latestVersion.Files))
|
||||
for i, f := range latestVersion.Files {
|
||||
files[i] = map[string]interface{}{
|
||||
"file_path": f.FilePath,
|
||||
"file_name": f.FileName,
|
||||
"file_size": f.FileSize,
|
||||
"file_hash": f.FileHash,
|
||||
"file_type": f.FileType,
|
||||
"is_required": f.IsRequired,
|
||||
}
|
||||
}
|
||||
|
||||
// 确定下载地址
|
||||
var downloadURL string
|
||||
var downloadSize int64
|
||||
@@ -285,7 +265,6 @@ func handleAppCheckUpdate(c *gin.Context) {
|
||||
"update_type": latestVersion.UpdateType,
|
||||
"update_method": latestVersion.UpdateMethod,
|
||||
"changelog": latestVersion.Changelog,
|
||||
"files": files,
|
||||
}
|
||||
|
||||
// 如果是补丁更新,添加补丁信息
|
||||
|
||||
Reference in New Issue
Block a user