fix:修复上传

This commit is contained in:
Hiven 2023-08-10 14:01:22 +08:00
parent 5470f22e77
commit 5f9888ca84
3 changed files with 11 additions and 5 deletions

View File

@ -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,
})

View File

@ -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")

View File

@ -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,