作者 yangfu

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

…tion-gateway into test
@@ -122,7 +122,7 @@ spec: @@ -122,7 +122,7 @@ spec:
122 - name: SUPLUS_SALE_APP 122 - name: SUPLUS_SALE_APP
123 value: "http://suplus-sale-app-gateway-test.fjmaimaimai.com" 123 value: "http://suplus-sale-app-gateway-test.fjmaimaimai.com"
124 - name: ALLIED_CREATION_REPORTING_SYSTEM 124 - name: ALLIED_CREATION_REPORTING_SYSTEM
125 - value: "https://allied-creation-reporting-system-dev.fjmaimaimai.com" 125 + value: "http://allied-creation-reporting-system-dev.fjmaimaimai.com"
126 # - name: REDIS_HOST 126 # - name: REDIS_HOST
127 # valueFrom: 127 # valueFrom:
128 # configMapKeyRef: 128 # configMapKeyRef:
@@ -72,7 +72,7 @@ func init() { @@ -72,7 +72,7 @@ func init() {
72 web.InsertFilter("/v1/cost/*", web.BeforeRouter, middleware.CheckAccessToken()) 72 web.InsertFilter("/v1/cost/*", web.BeforeRouter, middleware.CheckAccessToken())
73 web.InsertFilter("/v1/cost/*", web.BeforeRouter, middleware.RedirectInternalService("/v1/cost", cost_structured.NewHttpLibCostStructured(domain.Operator{}))) 73 web.InsertFilter("/v1/cost/*", web.BeforeRouter, middleware.RedirectInternalService("/v1/cost", cost_structured.NewHttpLibCostStructured(domain.Operator{})))
74 web.InsertFilter("/v1/chart-editor/*", web.BeforeRouter, middleware.CheckAccessToken()) 74 web.InsertFilter("/v1/chart-editor/*", web.BeforeRouter, middleware.CheckAccessToken())
75 - web.InsertFilter("/v1/chart-editor/*", web.BeforeRouter, middleware.RedirectInternalService("/chart-editor", chart_editor.NewHttpLibAlliedChartEditor(domain.Operator{}))) 75 + web.InsertFilter("/v1/chart-editor/*", web.BeforeRouter, middleware.RedirectInternalService("/v1/chart-editor", chart_editor.NewHttpLibAlliedChartEditor(domain.Operator{})))
76 } 76 }
77 77
78 func AllowCors() func(ctx *context.Context) { 78 func AllowCors() func(ctx *context.Context) {
@@ -7,6 +7,7 @@ import ( @@ -7,6 +7,7 @@ import (
7 "github.com/beego/beego/v2/server/web" 7 "github.com/beego/beego/v2/server/web"
8 "github.com/beego/beego/v2/server/web/context" 8 "github.com/beego/beego/v2/server/web/context"
9 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway" 9 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway"
  10 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
10 "io/ioutil" 11 "io/ioutil"
11 "net/http" 12 "net/http"
12 "strings" 13 "strings"
@@ -39,7 +40,7 @@ func RedirectInternalService(prefix string, svr internalService) web.FilterFunc @@ -39,7 +40,7 @@ func RedirectInternalService(prefix string, svr internalService) web.FilterFunc
39 method := strings.ToLower(ctx.Request.Method) 40 method := strings.ToLower(ctx.Request.Method)
40 url := strings.Replace(ctx.Request.RequestURI, prefix, "", 1) 41 url := strings.Replace(ctx.Request.RequestURI, prefix, "", 1)
41 req := svr.CreateRequest(svr.BaseUrl()+url, method) 42 req := svr.CreateRequest(svr.BaseUrl()+url, method)
42 - 43 + log.Logger.Debug(method + " 请求url:" + svr.BaseUrl() + url)
43 // 传递当前登录信息(可配置) 44 // 传递当前登录信息(可配置)
44 loginToken, ok := FormCtxLoginToken(ctx) 45 loginToken, ok := FormCtxLoginToken(ctx)
45 if ok && loginToken.CompanyId > 0 && loginToken.OrgId > 0 { 46 if ok && loginToken.CompanyId > 0 && loginToken.OrgId > 0 {
@@ -52,7 +53,6 @@ func RedirectInternalService(prefix string, svr internalService) web.FilterFunc @@ -52,7 +53,6 @@ func RedirectInternalService(prefix string, svr internalService) web.FilterFunc
52 } 53 }
53 req.Header("orgIds", fmt.Sprintf("%v", strings.Join(orgIdList, ","))) 54 req.Header("orgIds", fmt.Sprintf("%v", strings.Join(orgIdList, ",")))
54 } 55 }
55 -  
56 req.Body(ctx.Input.RequestBody) 56 req.Body(ctx.Input.RequestBody)
57 response, err := req.Response() 57 response, err := req.Response()
58 if err != nil { 58 if err != nil {