浏览代码

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)
 		}