mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-25 02:58:26 +08:00
update app
This commit is contained in:
parent
b6a5501f71
commit
46f9a00b75
@ -62,37 +62,18 @@ func UploadUpdateApp(c *gin.Context) {
|
|||||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "invalid file type" + err.Error()})
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "invalid file type" + err.Error()})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
fileObj, err := req.File.Open()
|
||||||
file, err := c.FormFile("file")
|
yamlObj, err := req.Yaml.Open()
|
||||||
if err != nil {
|
|
||||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "missing file arg", err.Error())
|
|
||||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "missing file arg: " + err.Error()})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
fileObj, err := file.Open()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "Open file error", err.Error())
|
log.NewError(req.OperationID, utils.GetSelfFuncName(), "Open file error", err.Error())
|
||||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "Open file error:" + err.Error()})
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "invalid file path" + err.Error()})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "name: ", newFileName, newYamlName, fileObj, yamlObj, req.File.Size, req.Yaml.Size)
|
||||||
yaml, err := c.FormFile("yaml")
|
|
||||||
if err != nil {
|
|
||||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "missing yaml arg", err.Error())
|
|
||||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "missing yaml arg: " + err.Error()})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
yamlObj, err := yaml.Open()
|
|
||||||
if err != nil {
|
|
||||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "open yaml failed", err.Error())
|
|
||||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "Open file error:" + err.Error()})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
//fmt.Println(req.OperationID, utils.GetSelfFuncName(), "name: ", newFileName, newYamlName, fileObj, yamlObj, file.Size, yaml.Size)
|
|
||||||
// v2.0.9_app_linux v2.0.9_yaml_linux
|
// v2.0.9_app_linux v2.0.9_yaml_linux
|
||||||
_, err = apiThird.MinioClient.PutObject(context.Background(), config.Config.Credential.Minio.AppBucket, newFileName, fileObj, file.Size, minio.PutObjectOptions{})
|
_, newType := utils.GetNewFileNameAndContentType("", constant.OtherType)
|
||||||
_, err = apiThird.MinioClient.PutObject(context.Background(), config.Config.Credential.Minio.AppBucket, newYamlName, yamlObj, yaml.Size, minio.PutObjectOptions{})
|
_, err = apiThird.MinioClient.PutObject(context.Background(), config.Config.Credential.Minio.AppBucket, newFileName, fileObj, req.File.Size, minio.PutObjectOptions{ContentType: newType})
|
||||||
|
_, err = apiThird.MinioClient.PutObject(context.Background(), config.Config.Credential.Minio.AppBucket, newYamlName, yamlObj, req.Yaml.Size, minio.PutObjectOptions{ContentType: newType})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "open file error")
|
log.NewError(req.OperationID, utils.GetSelfFuncName(), "open file error")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "invalid file path" + err.Error()})
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "invalid file path" + err.Error()})
|
||||||
|
@ -2,6 +2,7 @@ package cms_api_struct
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
apiStruct "Open_IM/pkg/base_info"
|
apiStruct "Open_IM/pkg/base_info"
|
||||||
|
"mime/multipart"
|
||||||
)
|
)
|
||||||
|
|
||||||
type AdminLoginRequest struct {
|
type AdminLoginRequest struct {
|
||||||
@ -14,12 +15,12 @@ type AdminLoginResponse struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type UploadUpdateAppReq struct {
|
type UploadUpdateAppReq struct {
|
||||||
OperationID string `form:"operationID" binding:"required"`
|
OperationID string `form:"operationID" binding:"required"`
|
||||||
Type int `form:"type" binding:"required"`
|
Type int `form:"type" binding:"required"`
|
||||||
Version string `form:"version" binding:"required"`
|
Version string `form:"version" binding:"required"`
|
||||||
//File multipart.FileHeader `form:"file" binding:"required"`
|
File multipart.FileHeader `form:"file" binding:"required"`
|
||||||
//Yaml multipart.FileHeader `form:"yaml" binding:"required"`
|
Yaml multipart.FileHeader `form:"yaml" binding:"required"`
|
||||||
ForceUpdate bool `form:"forceUpdate" binding:"required"`
|
ForceUpdate bool `form:"forceUpdate" binding:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type UploadUpdateAppResp struct {
|
type UploadUpdateAppResp struct {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user