maxiaoshan hace 5 años
padre
commit
9d2e8a8c64

+ 11 - 16
dataprocess/src/front/front.go

@@ -178,26 +178,21 @@ func (f *Front) PersonalMenu() {
 
 func GetUserMenu(role string) []map[string]interface{} {
 	list := []map[string]interface{}{}
-	maps := map[string]interface{}{}
-	if role == "0" {
-		maps = map[string]interface{}{}
-	} else {
-		maps = map[string]interface{}{
-			"role." + role: true,
-		}
+	maps := map[string]interface{}{
+		"delete": false,
+	}
+	if role != "0" {
+		maps["role."+role] = true
 	}
 	data, _ := Mgo.Find("menu_first", maps, nil, nil, false, -1, -1)
 	for _, d := range *data {
 		_id := d["_id"]
-		if role == "0" {
-			maps = map[string]interface{}{
-				"s_pid": qu.BsonIdToSId(_id),
-			}
-		} else {
-			maps = map[string]interface{}{
-				"role." + role: true,
-				"s_pid":        qu.BsonIdToSId(_id),
-			}
+		maps = map[string]interface{}{
+			"delete": false,
+			"s_pid":  qu.BsonIdToSId(_id),
+		}
+		if role != "0" {
+			maps["role."+role] = true
 		}
 		secdatas, _ := Mgo.Find("menu_second", maps, nil, nil, false, -1, -1)
 		secmenumap := map[string]interface{}{}

+ 0 - 1
dataprocess/src/main.go

@@ -5,7 +5,6 @@ import (
 	"time"
 
 	"./front"
-
 	. "./util"
 
 	"github.com/go-xweb/xweb"

+ 1 - 1
dataprocess/src/web/templates/com/header.html

@@ -84,7 +84,7 @@
 				     	<select id="t_role" class="form-control" disabled>
 							<option value={{(session "user").role}}>
 							<script>
-								role={{session "role"}}
+								role={{(session "user").role}};
 								if(role=="2"){
 									document.write("开发员")
 								}else if(role=="1"){

+ 0 - 1
dataprocess/src/web/templates/com/menu.html

@@ -49,7 +49,6 @@ $(function () {
 	$.post('/front/personalMenu','',function (data,status) {
 		for(var a=0;a<data.data.length;a++) {
             var info=data.data[a]
-			console.log(info)
 		    if (info.secondmenu){
                 var str=""
                	for(var sec=1;sec<=Object.keys(info.secondmenu).length;sec++){