Merge branch 'develop' of https://gitee.com/fusenpack/fusenapi into feature/auth

This commit is contained in:
eson
2023-08-14 14:12:33 +08:00
39 changed files with 581 additions and 287 deletions

View File

@@ -17,4 +17,5 @@ AWS:
Token:
BLMService:
LogoCombine:
Url: "http://192.168.1.7:45678/LogoCombine"
#Url: "http://192.168.1.7:8999/LogoCombine"
Url: "http://18.119.109.254:8999/LogoCombine"

View File

@@ -2,14 +2,16 @@ package logic
import (
"encoding/json"
"errors"
"fusenapi/model/gmodel"
"fusenapi/utils/auth"
"fusenapi/utils/basic"
"fusenapi/utils/curl"
"fusenapi/utils/file"
"fusenapi/utils/hash"
"io"
"net/http"
"strings"
"time"
"context"
@@ -17,6 +19,7 @@ import (
"fusenapi/server/resource/internal/types"
"github.com/zeromicro/go-zero/core/logx"
"gorm.io/gorm"
)
type LogoCombineLogic struct {
@@ -75,8 +78,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")
}
}
}
@@ -123,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")
@@ -134,8 +143,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")
}