From 94e15c1c19101f41c57220f334d64a09cd6daa48 Mon Sep 17 00:00:00 2001 From: Hiven Date: Fri, 11 Aug 2023 15:28:03 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fix:=E6=9B=B4=E6=96=B0=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E7=8E=AF=E5=A2=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/resource/etc/resource.yaml | 4 ++-- server/resource/internal/logic/logocombinelogic.go | 11 ++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/server/resource/etc/resource.yaml b/server/resource/etc/resource.yaml index 8e70bf17..cc596ed4 100644 --- a/server/resource/etc/resource.yaml +++ b/server/resource/etc/resource.yaml @@ -16,5 +16,5 @@ AWS: Token: BLMService: LogoCombine: - #Url: "http://192.168.1.7:45678/LogoCombine" - Url: "http://18.119.109.254:8999/LogoCombine" \ No newline at end of file + Url: "http://192.168.1.7:8999/LogoCombine" + #Url: "http://18.119.109.254:8999/LogoCombine" \ No newline at end of file diff --git a/server/resource/internal/logic/logocombinelogic.go b/server/resource/internal/logic/logocombinelogic.go index 71fca87d..b392a138 100644 --- a/server/resource/internal/logic/logocombinelogic.go +++ b/server/resource/internal/logic/logocombinelogic.go @@ -2,6 +2,7 @@ package logic import ( "encoding/json" + "errors" "fusenapi/model/gmodel" "fusenapi/utils/auth" "fusenapi/utils/basic" @@ -17,6 +18,7 @@ import ( "fusenapi/server/resource/internal/types" "github.com/zeromicro/go-zero/core/logx" + "gorm.io/gorm" ) type LogoCombineLogic struct { @@ -75,8 +77,10 @@ func (l *LogoCombineLogic) LogoCombine(req *types.LogoCombineReq, userinfo *auth }) } else { if err != nil { - logx.Error(err) - return resp.SetStatus(basic.CodeDbSqlErr, "LogoCombine error") + if !errors.Is(err, gorm.ErrRecordNotFound) { + logx.Error(err) + return resp.SetStatus(basic.CodeDbSqlErr, "LogoCombine error") + } } } @@ -134,8 +138,9 @@ func (l *LogoCombineLogic) LogoCombine(req *types.LogoCombineReq, userinfo *auth logx.Error(err) return resp.SetStatus(basic.CodeFileLogoCombineErr, "service read fail") } + ress := string(b) - if string(b) == "Internal Server Error" { + if ress == "Internal Server Error" { return resp.SetStatus(basic.CodeFileLogoCombineErr, "service read fail") } From a587a19dbfc146fcfe9392afeb0564a6323fe1f6 Mon Sep 17 00:00:00 2001 From: Hiven Date: Fri, 11 Aug 2023 15:30:55 +0800 Subject: [PATCH 2/3] =?UTF-8?q?fix:=E6=9B=B4=E6=96=B0=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E7=8E=AF=E5=A2=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/resource/etc/resource.yaml | 4 ++-- server/resource/internal/logic/logocombinelogic.go | 9 +++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/server/resource/etc/resource.yaml b/server/resource/etc/resource.yaml index cc596ed4..befe8caf 100644 --- a/server/resource/etc/resource.yaml +++ b/server/resource/etc/resource.yaml @@ -16,5 +16,5 @@ AWS: Token: BLMService: LogoCombine: - Url: "http://192.168.1.7:8999/LogoCombine" - #Url: "http://18.119.109.254:8999/LogoCombine" \ No newline at end of file + #Url: "http://192.168.1.7:8999/LogoCombine" + Url: "http://18.119.109.254:8999/LogoCombine" \ No newline at end of file diff --git a/server/resource/internal/logic/logocombinelogic.go b/server/resource/internal/logic/logocombinelogic.go index b392a138..86da8d7c 100644 --- a/server/resource/internal/logic/logocombinelogic.go +++ b/server/resource/internal/logic/logocombinelogic.go @@ -6,11 +6,12 @@ import ( "fusenapi/model/gmodel" "fusenapi/utils/auth" "fusenapi/utils/basic" + "fusenapi/utils/curl" "fusenapi/utils/file" "fusenapi/utils/hash" "io" - "net/http" "strings" + "time" "context" @@ -127,7 +128,11 @@ func (l *LogoCombineLogic) LogoCombine(req *types.LogoCombineReq, userinfo *auth postMap["param_data"] = combineParam postMapB, _ := json.Marshal(postMap) - result, err := http.Post(l.svcCtx.Config.BLMService.LogoCombine.Url, "application/json", strings.NewReader(string(postMapB))) + //result, err := http.Post(l.svcCtx.Config.BLMService.LogoCombine.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.LogoCombine.Url, "POST", headerData, strings.NewReader(string(postMapB)), time.Second*20) + if err != nil { logx.Error(err) return resp.SetStatus(basic.CodeFileLogoCombineErr, "service post fail") From 9b0a18fcd8077c05c98418dc1a47ef5b29692b78 Mon Sep 17 00:00:00 2001 From: Hiven Date: Fri, 11 Aug 2023 17:22:14 +0800 Subject: [PATCH 3/3] =?UTF-8?q?fix:=E6=9B=B4=E6=96=B0=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E7=8E=AF=E5=A2=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/upload/internal/logic/uploadlogologic.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/server/upload/internal/logic/uploadlogologic.go b/server/upload/internal/logic/uploadlogologic.go index ea98bf45..88744393 100644 --- a/server/upload/internal/logic/uploadlogologic.go +++ b/server/upload/internal/logic/uploadlogologic.go @@ -168,5 +168,12 @@ func (l *UploadLogoLogic) UploadLogo(req *types.UploadLogoReq, userinfo *auth.Us return resp.SetStatus(basic.CodeFileUploadLogoErr, "service fail") } - return resp.SetStatus(basic.CodeOK) + // 返回成功的响应和上传URL + return resp.SetStatus(basic.CodeOK, map[string]interface{}{ + "upload_data": UploadUrl{ + Status: 1, + ResourceId: uploadRes.ResourceId, + ResourceUrl: uploadRes.ResourceUrl, + }, + }) }