Browse Source

feat:调试

wangchuanjin 1 year ago
parent
commit
d639be50b1
1 changed files with 20 additions and 19 deletions
  1. 20 19
      core/proxy/broker/outServer/SussBi.go

+ 20 - 19
core/proxy/broker/outServer/SussBi.go

@@ -5,7 +5,6 @@ import (
 	"fmt"
 	"io"
 	"io/ioutil"
-	"log"
 	"net/http"
 	"net/http/cookiejar"
 	"net/url"
@@ -164,6 +163,26 @@ func (s *sussBi) RequestLogin(r *ghttp.Request) error {
 			r.Request.AddCookie(cookies[0])
 		}
 	}
+	ctx := router.GetGContext(r.GetCtx())
+	md5Val := common.GetMd5String(fmt.Sprintf("%s_%s_%d_%d_%d_%d_%d_%d_%s_%d_%s_%d", ctx.Sess.NickName, ctx.Sess.YyName, ctx.Sess.EntRole, ctx.Sess.EntNicheDis, ctx.Sess.PositionId, ctx.Sess.AccountId, ctx.Sess.EntAccountId, ctx.Sess.EntId, ctx.Sess.EntName, ctx.Sess.EntDeptId, ctx.Sess.EntUserName, ctx.Sess.EntUserId))
+	//if j_cookie, j_error := r.Request.Cookie("JSESSIONID"); j_error == nil && j_cookie != nil && j_cookie.Value != md5Val {
+	//log.Println("========删除 JSESSIONID", j_cookie.Value)
+	// http.SetCookie(r.Response.ResponseWriter, &http.Cookie{
+	// 	Name:   "JSESSIONID",
+	// 	Path:   "/succbi",
+	// 	MaxAge: -1,
+	// })
+	//}
+	c := &http.Cookie{
+		Name:     "BITOKEN",
+		Value:    md5Val,
+		Path:     "/",
+		HttpOnly: false,
+		MaxAge:   604800,
+		Expires:  time.Now().AddDate(0, 0, 7),
+	}
+	r.Request.AddCookie(c)
+	http.SetCookie(r.Response.ResponseWriter, c)
 	return nil
 }
 
@@ -177,24 +196,6 @@ func (s *sussBi) CheckLoginOut(r *ghttp.Request) bool {
 
 func (s *sussBi) Filter(r *ghttp.Request) error {
 	ctx := router.GetGContext(r.GetCtx())
-	md5Val := common.GetMd5String(fmt.Sprintf("%s_%s_%d_%d_%d_%d_%d_%d_%s_%d_%s_%d", ctx.Sess.NickName, ctx.Sess.YyName, ctx.Sess.EntRole, ctx.Sess.EntNicheDis, ctx.Sess.PositionId, ctx.Sess.AccountId, ctx.Sess.EntAccountId, ctx.Sess.EntId, ctx.Sess.EntName, ctx.Sess.EntDeptId, ctx.Sess.EntUserName, ctx.Sess.EntUserId))
-	if j_cookie, j_error := r.Request.Cookie("JSESSIONID"); j_error == nil && j_cookie != nil && j_cookie.Value != md5Val {
-		log.Println("========删除 JSESSIONID", j_cookie.Value)
-		// http.SetCookie(r.Response.ResponseWriter, &http.Cookie{
-		// 	Name:   "JSESSIONID",
-		// 	Path:   "/succbi",
-		// 	MaxAge: -1,
-		// })
-	}
-	log.Println("biurl", r.Request.RequestURI)
-	http.SetCookie(r.Response.ResponseWriter, &http.Cookie{
-		Name:     "BITOKEN",
-		Value:    md5Val,
-		Path:     "/",
-		HttpOnly: false,
-		MaxAge:   604800,
-		Expires:  time.Now().AddDate(0, 0, 7),
-	})
 	if ctx.Sess.NewUid != 0 {
 		replaceMap := map[string]interface{}{
 			"jyUserId":         ctx.Sess.PositionId,