Browse Source

Merge branch 'master' of http://git.shengws.com/csx/XT_New

csx 4 years ago
parent
commit
5391e148a6

+ 12 - 10
controllers/new_mobile_api_controllers/home_api_controller.go View File

41
 		orgs = RemoveRepeatedOrgElement(orgs)
41
 		orgs = RemoveRepeatedOrgElement(orgs)
42
 
42
 
43
 		var isSubSuperAdmin bool = false
43
 		var isSubSuperAdmin bool = false
44
-
45
-		app_role, _ := service.GetAppRoleById(adminUserInfo.AppRole.Id)
46
-		role_ids := strings.Split(app_role.RoleIds, ",")
47
-
48
-		if adminUserInfo.AdminUser.Id != adminUserInfo.Org.Creator {
49
-			for _, item := range role_ids {
50
-				id, _ := strconv.ParseInt(item, 10, 64)
51
-				role, _ := service.GetRoleByRoleID(id)
52
-				if role.IsSystem == 1 && role.RoleName == "子管理员" {
53
-					isSubSuperAdmin = true
44
+		if adminUserInfo.AppRole != nil && adminUserInfo.AppRole.Id > 0 {
45
+			app_role, _ := service.GetAppRoleById(adminUserInfo.AppRole.Id)
46
+			if len(app_role.RoleIds) > 0 {
47
+				role_ids := strings.Split(app_role.RoleIds, ",")
48
+				if adminUserInfo.AdminUser.Id != adminUserInfo.Org.Creator {
49
+					for _, item := range role_ids {
50
+						id, _ := strconv.ParseInt(item, 10, 64)
51
+						role, _ := service.GetRoleByRoleID(id)
52
+						if role.IsSystem == 1 && role.RoleName == "子管理员" {
53
+							isSubSuperAdmin = true
54
+						}
55
+					}
54
 				}
56
 				}
55
 			}
57
 			}
56
 		}
58
 		}

+ 16 - 1
controllers/new_mobile_api_controllers/new_role_api_controller.go View File

89
 	adminUserInfo := this.GetMobileAdminUserInfo()
89
 	adminUserInfo := this.GetMobileAdminUserInfo()
90
 	adminUserId, _ := this.GetInt64("uid")
90
 	adminUserId, _ := this.GetInt64("uid")
91
 
91
 
92
+	var isSubSuperAdmin bool = false
93
+	app_role, _ := service.GetAppRoleById(adminUserInfo.AppRole.Id)
94
+	role_ids := strings.Split(app_role.RoleIds, ",")
95
+
96
+	if adminUserInfo.AdminUser.Id != adminUserInfo.Org.Creator {
97
+		for _, item := range role_ids {
98
+			id, _ := strconv.ParseInt(item, 10, 64)
99
+			role, _ := service.GetRoleByRoleID(id)
100
+			if role.IsSystem == 1 && role.RoleName == "子管理员" {
101
+				isSubSuperAdmin = true
102
+			}
103
+		}
104
+	}
105
+
92
 	appRole, getAppRoleErr := service.GetAppRole(adminUserInfo.Org.Id, adminUserInfo.App.Id, adminUserId)
106
 	appRole, getAppRoleErr := service.GetAppRole(adminUserInfo.Org.Id, adminUserInfo.App.Id, adminUserId)
93
 	if getAppRoleErr != nil {
107
 	if getAppRoleErr != nil {
94
 		//beego.Error("查询管理员信息时失败:", getAppRoleErr)
108
 		//beego.Error("查询管理员信息时失败:", getAppRoleErr)
101
 	}
115
 	}
102
 
116
 
103
 	this.ServeSuccessJSON(map[string]interface{}{
117
 	this.ServeSuccessJSON(map[string]interface{}{
104
-		"user_info": appRole,
118
+		"user_info":          appRole,
119
+		"is_sub_super_admin": isSubSuperAdmin,
105
 	})
120
 	})
106
 
121
 
107
 }
122
 }