pull/232/head
wangchuxiao 3 years ago
parent f5d4397f0b
commit c998bce34f

@ -219,16 +219,11 @@ func GetDownloadURL(c *gin.Context) {
return return
} }
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req) log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req)
//fileName, yamlName, err := utils.GetUploadAppNewName(req.Type, req.Version, req.)
//if err != nil {
// log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetUploadAppNewName failed", err.Error())
// c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "invalid file type" + err.Error()})
// return
//}
app, err := imdb.GetNewestVersion(req.Type) app, err := imdb.GetNewestVersion(req.Type)
if err != nil { if err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), "getNewestVersion failed", err.Error()) log.NewError(req.OperationID, utils.GetSelfFuncName(), "getNewestVersion failed", err.Error())
} }
log.Debug(req.OperationID, utils.GetSelfFuncName(), "app: ", app)
if app != nil { if app != nil {
if app.Version != req.Version && app.Version != "" { if app.Version != req.Version && app.Version != "" {
resp.Data.HasNewVersion = true resp.Data.HasNewVersion = true
@ -238,9 +233,11 @@ func GetDownloadURL(c *gin.Context) {
resp.Data.YamlURL = config.Config.Credential.Minio.Endpoint + "/" + config.Config.Credential.Minio.AppBucket + "/" + app.YamlName resp.Data.YamlURL = config.Config.Credential.Minio.Endpoint + "/" + config.Config.Credential.Minio.AppBucket + "/" + app.YamlName
resp.Data.FileURL = config.Config.Credential.Minio.Endpoint + "/" + config.Config.Credential.Minio.AppBucket + "/" + app.FileName resp.Data.FileURL = config.Config.Credential.Minio.Endpoint + "/" + config.Config.Credential.Minio.AppBucket + "/" + app.FileName
c.JSON(http.StatusOK, resp) c.JSON(http.StatusOK, resp)
return
} else { } else {
resp.Data.HasNewVersion = false resp.Data.HasNewVersion = false
c.JSON(http.StatusOK, resp) c.JSON(http.StatusOK, resp)
return
} }
} }
c.JSON(http.StatusBadRequest, gin.H{"errCode": 0, "errMsg": "not found app version"}) c.JSON(http.StatusBadRequest, gin.H{"errCode": 0, "errMsg": "not found app version"})

Loading…
Cancel
Save