作者 庄敏学

add log

@@ -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 {