From 472cda83159b6862b605645e223456a6961362a8 Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Tue, 10 May 2022 16:59:45 +0800 Subject: [PATCH] update app --- .../api/third/minio_storage_credential.go | 29 ------------------- .../mysql_model/im_mysql_model/file_model.go | 2 +- 2 files changed, 1 insertion(+), 30 deletions(-) diff --git a/internal/api/third/minio_storage_credential.go b/internal/api/third/minio_storage_credential.go index f1c4401e6..1b3b6aeb3 100644 --- a/internal/api/third/minio_storage_credential.go +++ b/internal/api/third/minio_storage_credential.go @@ -176,41 +176,12 @@ func UploadUpdateApp(c *gin.Context) { return } - // v2.0.9_app_linux v2.0.9_yaml_linux - - //file, err := c.FormFile("file") - //if err != nil { - // log.NewError(req.OperationID, utils.GetSelfFuncName(), "FormFile failed", err.Error()) - // c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "missing file arg: " + err.Error()}) - // return - //} - //fileObj, err := file.Open() - //if err != nil { - // log.NewError(req.OperationID, utils.GetSelfFuncName(), "Open file error", err.Error()) - // c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "invalid file path" + err.Error()}) - // return - //} - // - //yaml, err := c.FormFile("yaml") - //if err != nil { - // log.NewError(req.OperationID, utils.GetSelfFuncName(), "FormFile failed", err.Error()) - // c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "missing file arg: " + err.Error()}) - // return - //} - //yamlObj, err := yaml.Open() - //if err != nil { - // log.NewError(req.OperationID, utils.GetSelfFuncName(), "Open file error", err.Error()) - // c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "invalid file path" + err.Error()}) - // return - //} newFileName, newYamlName, err := utils.GetUploadAppNewName(req.Type, req.Version, req.File.Filename, req.Yaml.Filename) 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 } - fmt.Println(req.OperationID, utils.GetSelfFuncName(), "name: ", config.Config.Credential.Minio.AppBucket, newFileName, fileObj, req.File.Size) - fmt.Println(req.OperationID, utils.GetSelfFuncName(), "name: ", config.Config.Credential.Minio.AppBucket, newYamlName, yamlObj, req.Yaml.Size) _, err = MinioClient.PutObject(context.Background(), config.Config.Credential.Minio.AppBucket, newFileName, fileObj, req.File.Size, minio.PutObjectOptions{ContentType: path.Ext(newFileName)}) if err != nil { diff --git a/pkg/common/db/mysql_model/im_mysql_model/file_model.go b/pkg/common/db/mysql_model/im_mysql_model/file_model.go index 7d6144633..babcc13be 100644 --- a/pkg/common/db/mysql_model/im_mysql_model/file_model.go +++ b/pkg/common/db/mysql_model/im_mysql_model/file_model.go @@ -18,7 +18,7 @@ func UpdateAppVersion(appType int, version string, forceUpdate bool, fileName, y FileName: fileName, YamlName: yamlName, } - result := dbConn.Model(db.AppVersion{}).Where("app_type = ?", appType).Updates(&app) + result := dbConn.Model(db.AppVersion{}).Where("type = ?", appType).Updates(&app) if result.Error != nil { return result.Error }