fix delete

This commit is contained in:
wangchuxiao
2022-08-10 19:31:57 +08:00
parent cdc60ef5f0
commit 6bfa8643d6
7 changed files with 114 additions and 8 deletions
+16 -1
View File
@@ -15,6 +15,8 @@ import (
_ "github.com/minio/minio-go/v7"
cr "github.com/minio/minio-go/v7/pkg/credentials"
"net/http"
"strconv"
"strings"
)
// @Summary minio上传文件(web api)
@@ -218,6 +220,13 @@ func UploadUpdateApp(c *gin.Context) {
c.JSON(http.StatusOK, resp)
}
func version2Int(version string) (int, error) {
versions := strings.Split(version, ".")
s := strings.Join(versions, "")
versionInt, err := strconv.Atoi(s)
return versionInt, err
}
func GetDownloadURL(c *gin.Context) {
var (
req api.GetDownloadURLReq
@@ -238,7 +247,13 @@ func GetDownloadURL(c *gin.Context) {
}
log.Debug(req.OperationID, utils.GetSelfFuncName(), "app: ", app)
if app != nil {
if app.Version != req.Version && app.Version != "" {
appVersion, err := version2Int(app.Version)
reqVersion, err := version2Int(req.Version)
if err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error(), "req version", req.Version, "app version", app.Version)
}
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "req version:", reqVersion, "app version:", appVersion)
if appVersion > reqVersion && app.Version != "" {
resp.Data.HasNewVersion = true
if app.ForceUpdate == true {
resp.Data.ForceUpdate = true