From 8b887f432b0ba5a294947159decbc694f9d50efc Mon Sep 17 00:00:00 2001 From: admin Date: Wed, 3 Jun 2026 03:47:21 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=AE=80=E5=8C=96=E6=A3=80=E6=B5=8B?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=20API=20=E8=BF=94=E5=9B=9E=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=EF=BC=8C=E7=A7=BB=E9=99=A4=20files=20=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除 ZIP 包内文件列表的返回,客户端只需要补丁包/完整包信息 - 返回数据更简洁:download_url, file_size, file_hash, patch_url 等 Co-Authored-By: Claude Opus 4.8 --- backend/internal/router/app/info.go | 39 +++++++---------------------- 1 file changed, 9 insertions(+), 30 deletions(-) diff --git a/backend/internal/router/app/info.go b/backend/internal/router/app/info.go index 1002f17..647596a 100644 --- a/backend/internal/router/app/info.go +++ b/backend/internal/router/app/info.go @@ -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, } // 如果是补丁更新,添加补丁信息