|
@@ -1,17 +1,18 @@
|
|
|
package outServer
|
|
|
|
|
|
import (
|
|
|
- "bp.jydev.jianyu360.cn/BaseService/gateway/core/router"
|
|
|
"bytes"
|
|
|
"fmt"
|
|
|
- "github.com/gogf/gf/v2/net/ghttp"
|
|
|
- "github.com/gogf/gf/v2/util/gconv"
|
|
|
- "golang.org/x/net/publicsuffix"
|
|
|
"io"
|
|
|
"io/ioutil"
|
|
|
"net/http"
|
|
|
"net/http/cookiejar"
|
|
|
"net/url"
|
|
|
+
|
|
|
+ "bp.jydev.jianyu360.cn/BaseService/gateway/core/router"
|
|
|
+ "github.com/gogf/gf/v2/net/ghttp"
|
|
|
+ "github.com/gogf/gf/v2/util/gconv"
|
|
|
+ "golang.org/x/net/publicsuffix"
|
|
|
)
|
|
|
|
|
|
type sussBi struct {
|
|
@@ -75,7 +76,17 @@ func (s *sussBi) Filter(r *ghttp.Request) error {
|
|
|
return err
|
|
|
}
|
|
|
if len(bodyBytes) > 0 {
|
|
|
+ replaceMap := map[string]interface{}{
|
|
|
+ "jyUserPositionId": ctx.Sess.UserPositionId,
|
|
|
+ "jyUserAccountId": ctx.Sess.UserAccountId,
|
|
|
+ "jyEntPositionId": ctx.Sess.EntPositionId,
|
|
|
+ "jyEntAccountId": ctx.Sess.EntAccountId,
|
|
|
+ "jyUserName": ctx.Sess.UserName,
|
|
|
+ }
|
|
|
finalBytes := bytes.ReplaceAll(bodyBytes, []byte(`"jyUserId"`), []byte(fmt.Sprintf(`"%d"`, ctx.Sess.NewUid)))
|
|
|
+ for k, v := range replaceMap {
|
|
|
+ finalBytes = bytes.ReplaceAll(finalBytes, []byte(`"`+k+`"`), []byte(`"`+fmt.Sprint(v)+`"`))
|
|
|
+ }
|
|
|
r.ContentLength = gconv.Int64(len(finalBytes))
|
|
|
r.Request.Header.Set("Content-Length", fmt.Sprintf("%d", len(finalBytes)))
|
|
|
//fmt.Printf("before len:%d value:%s\nafter: len:%d value:%s\n", len(bodyBytes), string(bodyBytes), len(finalBytes), string(finalBytes))
|