diff --git a/server/upload/internal/logic/uploadfilesbackendlogic.go b/server/upload/internal/logic/uploadfilesbackendlogic.go index 24a5aeaa..6995b0c7 100644 --- a/server/upload/internal/logic/uploadfilesbackendlogic.go +++ b/server/upload/internal/logic/uploadfilesbackendlogic.go @@ -145,7 +145,7 @@ func (l *UploadFilesBackendLogic) UploadFilesBackend(req *types.UploadFilesReq, FileHash: resourceId, FileByte: uploadDataInfo.FileData, UploadBucket: 1, - ApiType: 2, + ApiType: req.ApiType, UserId: userId, GuestId: guestId, }) diff --git a/server/upload/internal/logic/uploadlogologic.go b/server/upload/internal/logic/uploadlogologic.go index 579ef53c..7bbc20e2 100644 --- a/server/upload/internal/logic/uploadlogologic.go +++ b/server/upload/internal/logic/uploadlogologic.go @@ -5,8 +5,8 @@ import ( "fusenapi/model/gmodel" "fusenapi/utils/auth" "fusenapi/utils/basic" + "fusenapi/utils/curl" "io" - "net/http" "strings" "time" @@ -83,11 +83,17 @@ func (l *UploadLogoLogic) UploadLogo(req *types.UploadLogoReq, userinfo *auth.Us } var resultStr string var err error + var postMap = make(map[string]interface{}, 1) postMap["logo_url"] = req.ResourceUrl postMapB, _ := json.Marshal(postMap) - result, err := http.Post(l.svcCtx.Config.BLMService.ImageProcess.Url, "application/json", strings.NewReader(string(postMapB))) + //result, err := http.Post(l.svcCtx.Config.BLMService.ImageProcess.Url, "application/json", strings.NewReader(string(postMapB))) + + var headerData = make(map[string]string, 1) + headerData["Content-Type"] = "application/json" + result, err := curl.ApiCall(l.svcCtx.Config.BLMService.ImageProcess.Url, "POST", headerData, strings.NewReader(string(postMapB)), 20) + if err != nil { logx.Error(err) return resp.SetStatus(basic.CodeFileUploadLogoErr, "service fail") diff --git a/utils/file/upload.go b/utils/file/upload.go index 0038ed1c..07e7c719 100644 --- a/utils/file/upload.go +++ b/utils/file/upload.go @@ -109,7 +109,7 @@ func (upload *Upload) UploadFileByBase64(req *UploadBaseReq) (*UploadBaseRes, er uploadBaseRes.ResourceUrl = url var version string = "0.0.1" var nowTime = time.Now() - _, err = resourceModelTS.Create(upload.Ctx, &gmodel.FsResource{ + _, err = resourceModelTS.Create(ctx, &gmodel.FsResource{ ResourceId: resourceId, UserId: &req.UserId, GuestId: &req.GuestId, @@ -198,7 +198,7 @@ func (upload *Upload) UploadFileByByte(req *UploadBaseReq) (*UploadBaseRes, erro uploadBaseRes.ResourceUrl = url var version string = "0.0.1" var nowTime = time.Now() - _, err = resourceModelTS.Create(upload.Ctx, &gmodel.FsResource{ + _, err = resourceModelTS.Create(ctx, &gmodel.FsResource{ ResourceId: resourceId, UserId: &req.UserId, GuestId: &req.GuestId,