...
|
...
|
@@ -7,6 +7,7 @@ import ( |
|
|
"github.com/beego/beego/v2/server/web"
|
|
|
"github.com/beego/beego/v2/server/web/context"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
|
|
|
"io/ioutil"
|
|
|
"net/http"
|
|
|
"strings"
|
...
|
...
|
@@ -39,7 +40,7 @@ func RedirectInternalService(prefix string, svr internalService) web.FilterFunc |
|
|
method := strings.ToLower(ctx.Request.Method)
|
|
|
url := strings.Replace(ctx.Request.RequestURI, prefix, "", 1)
|
|
|
req := svr.CreateRequest(svr.BaseUrl()+url, method)
|
|
|
|
|
|
log.Logger.Debug(method + " 请求url:" + svr.BaseUrl() + url)
|
|
|
// 传递当前登录信息(可配置)
|
|
|
loginToken, ok := FormCtxLoginToken(ctx)
|
|
|
if ok && loginToken.CompanyId > 0 && loginToken.OrgId > 0 {
|
...
|
...
|
@@ -52,7 +53,6 @@ func RedirectInternalService(prefix string, svr internalService) web.FilterFunc |
|
|
}
|
|
|
req.Header("orgIds", fmt.Sprintf("%v", strings.Join(orgIdList, ",")))
|
|
|
}
|
|
|
|
|
|
req.Body(ctx.Input.RequestBody)
|
|
|
response, err := req.Response()
|
|
|
if err != nil {
|
...
|
...
|
|