소스 검색

feat:header

zhangxinlei1996 3 년 전
부모
커밋
3a5c7291b9
1개의 변경된 파일4개의 추가작업 그리고 3개의 파일을 삭제
  1. 4 3
      core/proxy/middleware/filterFuncs.go

+ 4 - 3
core/proxy/middleware/filterFuncs.go

@@ -19,13 +19,14 @@ import (
 func filterBefore(r *ghttp.Request) error {
 	ctx := router.GetGContext(r.GetCtx())
 	rule := ctx.RouterRule
+
+	//注入用户身份
+	infusionIdentity(r, ctx.Sess, rule.AppId)
+
 	if rule.SessCheck.NeedCheck() {
 
 		uCheck, eCheck := rule.SessCheck.CheckUserSession(), rule.SessCheck.CheckEntSession()
 
-		//注入用户身份
-		infusionIdentity(r, ctx.Sess, rule.AppId)
-
 		if uCheck && ctx.Sess.UserId == "" {
 			return NewErrorWithCode(GLOBAL_ERR_NOTLOGIN)
 		}