|
@@ -1,6 +1,7 @@
|
|
|
package middleware
|
|
|
|
|
|
import (
|
|
|
+ "app.yhyue.com/moapp/jybase/common"
|
|
|
. "bp.jydev.jianyu360.cn/BaseService/gateway/common/gatecode"
|
|
|
"bp.jydev.jianyu360.cn/BaseService/gateway/common/httpUtil"
|
|
|
"bp.jydev.jianyu360.cn/BaseService/gateway/core/proxy/filterPoly"
|
|
@@ -27,8 +28,10 @@ func FilterPolyHandler(r *ghttp.Request) {
|
|
|
//获取策略
|
|
|
poly := filterPolyManager.GetRule(gCtx.RouterRule.LimitPloy)
|
|
|
status, key := func() (int, string) {
|
|
|
+ //用户身份切换
|
|
|
+ userFlag, _ := common.If(gCtx.Sess.MgoUserId != "", gCtx.Sess.MgoUserId, gCtx.Sess.UserId).(string)
|
|
|
if gCtx.Sess.UserId != "" && poly.Rule.BCheckId { //id请求频率校验
|
|
|
- return poly.IdFilter(ctx, gCtx.Sess.UserId)
|
|
|
+ return poly.IdFilter(ctx, userFlag)
|
|
|
} else { //ip请求频率校验
|
|
|
return poly.IpFilter(ctx, r.GetClientIp())
|
|
|
}
|
|
@@ -57,7 +60,7 @@ func FilterPolyHandler(r *ghttp.Request) {
|
|
|
r.Middleware.Next()
|
|
|
}
|
|
|
|
|
|
-//getVerifyPage 获取验证码页面路径
|
|
|
+// getVerifyPage 获取验证码页面路径
|
|
|
func getVerifyPage(page string) string {
|
|
|
if page != "" {
|
|
|
if strings.HasSuffix(page, ".html") {
|