Ver código fonte

权限判断完善

yxh 5 anos atrás
pai
commit
1398c662fb

+ 1 - 1
app/model/admin/sys_config/sys_config.go

@@ -121,7 +121,7 @@ func SelectListByPage(req *SelectPageReq) (total, page int, list []*Entity, err
 			model = model.Where("config_name like ?", "%"+req.ConfigName+"%")
 		}
 		if req.ConfigType != "" {
-			model = model.Where("status = ", gconv.Int(req.ConfigType))
+			model = model.Where("config_type = ", gconv.Int(req.ConfigType))
 		}
 		if req.ConfigKey != "" {
 			model = model.Where("config_key like ?", "%"+req.ConfigKey+"%")

+ 3 - 2
middleWare/middleware.go

@@ -27,7 +27,7 @@ func Auth(r *ghttp.Request) {
 	}*/
 	accessParams := r.GetStrings("accessParams")
 	accessParamsStr := ""
-	if len(accessParams) > 0 {
+	if len(accessParams) > 0 && accessParams[0] != "undefined" {
 		accessParamsStr = "?" + gstr.Join(accessParams, "&")
 	}
 	//获取登陆用户id
@@ -48,7 +48,8 @@ func Auth(r *ghttp.Request) {
 	}
 	var menu *auth_rule.Entity
 	for _, m := range menuList {
-		if gstr.Equal(m.Name, url) {
+		ms := gstr.SubStr(m.Name, 0, gstr.Pos(m.Name, "?"))
+		if m.Name == url || ms == url {
 			menu = m
 			break
 		}