fix: check-update无版本号时download_url优先指向全量包
This commit is contained in:
@@ -95,14 +95,20 @@ func handleAppCheckUpdate(c *gin.Context) {
|
||||
return v
|
||||
}
|
||||
|
||||
// 如果没有传入版本号,直接返回最新版本
|
||||
// 如果没有传入版本号,直接返回最新版本(安装器模式,优先全量包)
|
||||
if clientVersion == "" {
|
||||
latestVersion := &allVersions[0]
|
||||
|
||||
// 确定下载地址:优先使用自定义地址
|
||||
downloadURL := latestVersion.FilePath
|
||||
downloadSize := latestVersion.FileSize
|
||||
downloadHash := latestVersion.FileHash
|
||||
// 确定下载地址:无版本号时 download_url 优先指向全量包
|
||||
downloadURL := latestVersion.FullPackagePath
|
||||
downloadSize := latestVersion.FullPackageSize
|
||||
downloadHash := latestVersion.FullPackageHash
|
||||
if downloadURL == "" {
|
||||
// 没有全量包,使用文件路径
|
||||
downloadURL = latestVersion.FilePath
|
||||
downloadSize = latestVersion.FileSize
|
||||
downloadHash = latestVersion.FileHash
|
||||
}
|
||||
if latestVersion.CustomDownloadURL != "" {
|
||||
downloadURL = latestVersion.CustomDownloadURL
|
||||
}
|
||||
@@ -121,7 +127,14 @@ func handleAppCheckUpdate(c *gin.Context) {
|
||||
"changelog": latestVersion.Changelog,
|
||||
}
|
||||
|
||||
// 如果有完整包,添加完整包信息
|
||||
// 同时返回补丁包信息(如果有),供客户端增量更新使用
|
||||
if latestVersion.FilePath != "" && latestVersion.FilePath != downloadURL {
|
||||
result["patch_url"] = latestVersion.FilePath
|
||||
result["patch_size"] = latestVersion.FileSize
|
||||
result["patch_hash"] = latestVersion.FileHash
|
||||
}
|
||||
|
||||
// 如果有完整包,也单独返回完整包信息
|
||||
if latestVersion.FullPackagePath != "" {
|
||||
result["full_package_url"] = latestVersion.FullPackagePath
|
||||
result["full_package_size"] = latestVersion.FullPackageSize
|
||||
|
||||
Reference in New Issue
Block a user