作者 yangfu

Merge branch 'test' of http://gitlab.fjmaimaimai.com/allied-creation/allied-crea…

…tion-gateway into test
... ... @@ -122,7 +122,7 @@ spec:
- name: SUPLUS_SALE_APP
value: "http://suplus-sale-app-gateway-test.fjmaimaimai.com"
- name: ALLIED_CREATION_REPORTING_SYSTEM
value: "https://allied-creation-reporting-system-dev.fjmaimaimai.com"
value: "http://allied-creation-reporting-system-dev.fjmaimaimai.com"
# - name: REDIS_HOST
# valueFrom:
# configMapKeyRef:
... ...
... ... @@ -72,7 +72,7 @@ func init() {
web.InsertFilter("/v1/cost/*", web.BeforeRouter, middleware.CheckAccessToken())
web.InsertFilter("/v1/cost/*", web.BeforeRouter, middleware.RedirectInternalService("/v1/cost", cost_structured.NewHttpLibCostStructured(domain.Operator{})))
web.InsertFilter("/v1/chart-editor/*", web.BeforeRouter, middleware.CheckAccessToken())
web.InsertFilter("/v1/chart-editor/*", web.BeforeRouter, middleware.RedirectInternalService("/chart-editor", chart_editor.NewHttpLibAlliedChartEditor(domain.Operator{})))
web.InsertFilter("/v1/chart-editor/*", web.BeforeRouter, middleware.RedirectInternalService("/v1/chart-editor", chart_editor.NewHttpLibAlliedChartEditor(domain.Operator{})))
}
func AllowCors() func(ctx *context.Context) {
... ...
... ... @@ -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 {
... ...