Kaynağa Gözat

管理员 登录跳转

wangshan 5 yıl önce
ebeveyn
işleme
d7ca0c3e95
1 değiştirilmiş dosya ile 12 ekleme ve 10 silme
  1. 12 10
      core/src/qfw/manage/rbac.go

+ 12 - 10
core/src/qfw/manage/rbac.go

@@ -46,17 +46,19 @@ func (this *Rbac) ToEachPage() error {
 	u := FindOne("user", "{'_id':'"+userId+"'}")
 	u_type := (*u)["i_type"]
 	if u_type == 0 {
-		pids := util.ObjToString((*u)["s_power"])
-		if len(strings.Split(pids, ",")) > 0 {
-			var ids []bson.ObjectId
-			for _, chid := range strings.Split(pids, ",") {
-				ids = append(ids, bson.ObjectIdHex(chid))
-			}
-			resultMap = Find("catalog", bson.M{"_id": bson.M{"$in": ids}}, nil, nil, false, -1, -1)
-		}
 		firstUrl := "/"
-		if len(*resultMap) > 0 {
-			firstUrl = util.ObjToString((*resultMap)[0]["s_url"])
+		if (*u)["s_power"] != nil {
+			pids := util.ObjToString((*u)["s_power"])
+			if len(strings.Split(pids, ",")) > 0 {
+				var ids []bson.ObjectId
+				for _, chid := range strings.Split(pids, ",") {
+					ids = append(ids, bson.ObjectIdHex(chid))
+				}
+				resultMap = Find("catalog", bson.M{"_id": bson.M{"$in": ids}}, nil, nil, false, -1, -1)
+			}
+			if len(*resultMap) > 0 {
+				firstUrl = util.ObjToString((*resultMap)[0]["s_url"])
+			}
 		}
 		return this.Redirect(firstUrl)
 	} else if u_type == -1 {