Browse Source

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

csx 4 years ago
parent
commit
4b118a39c9

+ 4 - 2
controllers/new_mobile_api_controllers/home_api_controller.go View File

@@ -50,8 +50,10 @@ func (this *HomeController) GetHomeData() {
50 50
 						id, _ := strconv.ParseInt(item, 10, 64)
51 51
 						if id > 0 {
52 52
 							role, _ := service.GetRoleByRoleID(id)
53
-							if role.IsSystem == 1 && role.RoleName == "子管理员" {
54
-								isSubSuperAdmin = true
53
+							if role != nil {
54
+								if role.IsSystem == 1 && role.RoleName == "子管理员" {
55
+									isSubSuperAdmin = true
56
+								}
55 57
 							}
56 58
 						}
57 59
 					}

+ 1 - 1
controllers/new_mobile_api_controllers/new_dialysis_api_controller.go View File

@@ -1000,7 +1000,7 @@ func (this *NewDialysisApiController) ToSearchePatient() {
1000 1000
 	fmt.Print("关键字", keyword)
1001 1001
 	adminUserinfo := this.GetMobileAdminUserInfo()
1002 1002
 	orgid := adminUserinfo.Org.Id
1003
-	fmt.Println("j击鼓ID=--------------------------", orgid)
1003
+	fmt.Println(orgid)
1004 1004
 	patient, err := service.ToSearchePatient(keyword, orgid)
1005 1005
 	if err != nil {
1006 1006
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)

+ 13 - 7
controllers/new_mobile_api_controllers/new_role_api_controller.go View File

@@ -26,9 +26,10 @@ func (this *NewRoleApiController) GetAllOrgUser() {
26 26
 				id, _ := strconv.ParseInt(item, 10, 64)
27 27
 				if id != 0 {
28 28
 					role, _ := service.GetRoleByRoleID(id)
29
-
30
-					if role.IsSystem == 1 && role.RoleName == "子管理员" {
31
-						isSubSuperAdmin = true
29
+					if role != nil {
30
+						if role.IsSystem == 1 && role.RoleName == "子管理员" {
31
+							isSubSuperAdmin = true
32
+						}
32 33
 					}
33 34
 				}
34 35
 
@@ -104,8 +105,11 @@ func (this *NewRoleApiController) GetAdminUserInfo() {
104 105
 				id, _ := strconv.ParseInt(item, 10, 64)
105 106
 				if id != 0 {
106 107
 					role, _ := service.GetRoleByRoleID(id)
107
-					if role.IsSystem == 1 && role.RoleName == "子管理员" {
108
-						isSubSuperAdmin = true
108
+					if role != nil {
109
+
110
+						if role.IsSystem == 1 && role.RoleName == "子管理员" {
111
+							isSubSuperAdmin = true
112
+						}
109 113
 					}
110 114
 				}
111 115
 			}
@@ -247,8 +251,10 @@ func (this *NewRoleApiController) GetAllOrgRole() {
247 251
 				id, _ := strconv.ParseInt(item, 10, 64)
248 252
 				if id != 0 {
249 253
 					role, _ := service.GetRoleByRoleID(id)
250
-					if role.IsSystem == 1 && role.RoleName == "子管理员" {
251
-						isSubSuperAdmin = true
254
+					if role != nil {
255
+						if role.IsSystem == 1 && role.RoleName == "子管理员" {
256
+							isSubSuperAdmin = true
257
+						}
252 258
 					}
253 259
 				}
254 260
 			}

+ 16 - 8
controllers/role_controller.go View File

@@ -358,8 +358,10 @@ func (this *RoleAPIController) AdminMainView() {
358 358
 				id, _ := strconv.ParseInt(item, 10, 64)
359 359
 				if id != 0 {
360 360
 					role, _ := service.GetRoleByRoleID(id)
361
-					if role.IsSystem == 1 && role.RoleName == "子管理员" {
362
-						isSubSuperAdmin = true
361
+					if role != nil {
362
+						if role.IsSystem == 1 && role.RoleName == "子管理员" {
363
+							isSubSuperAdmin = true
364
+						}
363 365
 					}
364 366
 				}
365 367
 			}
@@ -425,8 +427,10 @@ func (this *RoleAPIController) AddAdminInitData() {
425 427
 				id, _ := strconv.ParseInt(item, 10, 64)
426 428
 				if id != 0 {
427 429
 					role, _ := service.GetRoleByRoleID(id)
428
-					if role.IsSystem == 1 && role.RoleName == "子管理员" {
429
-						isSubSuperAdmin = true
430
+					if role != nil {
431
+						if role.IsSystem == 1 && role.RoleName == "子管理员" {
432
+							isSubSuperAdmin = true
433
+						}
430 434
 					}
431 435
 				}
432 436
 			}
@@ -844,8 +848,10 @@ func (this *RoleAPIController) GetAllOrgRole() {
844 848
 				id, _ := strconv.ParseInt(item, 10, 64)
845 849
 				if id != 0 {
846 850
 					role, _ := service.GetRoleByRoleID(id)
847
-					if role.IsSystem == 1 && role.RoleName == "子管理员" {
848
-						isSubSuperAdmin = true
851
+					if role != nil {
852
+						if role.IsSystem == 1 && role.RoleName == "子管理员" {
853
+							isSubSuperAdmin = true
854
+						}
849 855
 					}
850 856
 				}
851 857
 			}
@@ -881,8 +887,10 @@ func (this *RoleAPIController) GetAllOrgUser() {
881 887
 				id, _ := strconv.ParseInt(item, 10, 64)
882 888
 				if id != 0 {
883 889
 					role, _ := service.GetRoleByRoleID(id)
884
-					if role.IsSystem == 1 && role.RoleName == "子管理员" {
885
-						isSubSuperAdmin = true
890
+					if role != nil {
891
+						if role.IsSystem == 1 && role.RoleName == "子管理员" {
892
+							isSubSuperAdmin = true
893
+						}
886 894
 					}
887 895
 				}
888 896
 			}

+ 18 - 12
service/role_service.go View File

@@ -47,8 +47,10 @@ func GetAppRole(orgID int64, appID int64, adminUserID int64) (*models.App_Role,
47 47
 			id, _ := strconv.ParseInt(item, 10, 64)
48 48
 			if id != 0 {
49 49
 				role, _ := GetRoleByRoleID(id)
50
-				if role.IsSystem == 1 && role.RoleName == "子管理员" {
51
-					appRole.IsSubSuperAdmin = true
50
+				if role != nil {
51
+					if role.IsSystem == 1 && role.RoleName == "子管理员" {
52
+						appRole.IsSubSuperAdmin = true
53
+					}
52 54
 				}
53 55
 			}
54 56
 		}
@@ -168,14 +170,16 @@ func GetAdminUsersAndLoginInfo(orgID int64, appID int64, page int, count int) ([
168 170
 				id, _ := strconv.ParseInt(id, 10, 64)
169 171
 				if id != 0 {
170 172
 					role, _ := GetRoleByRoleID(id)
171
-					if role.IsSystem == 1 && role.RoleName == "子管理员" {
172
-						item.IsSubSuperAdmin = true
173
-					}
174
-
175
-					if len(item.RoleName) == 0 {
176
-						item.RoleName = role.RoleName
177
-					} else {
178
-						item.RoleName = item.RoleName + "," + role.RoleName
173
+					if role != nil {
174
+						if role.IsSystem == 1 && role.RoleName == "子管理员" {
175
+							item.IsSubSuperAdmin = true
176
+						}
177
+
178
+						if len(item.RoleName) == 0 {
179
+							item.RoleName = role.RoleName
180
+						} else {
181
+							item.RoleName = item.RoleName + "," + role.RoleName
182
+						}
179 183
 					}
180 184
 				}
181 185
 			}
@@ -619,8 +623,10 @@ func GetAllAdminUsersAndRole(orgID int64, appID int64, page int, count int) ([]*
619 623
 				id, _ := strconv.ParseInt(ids, 10, 64)
620 624
 				if id != 0 {
621 625
 					role, _ := GetRoleByRoleID(id)
622
-					if role.IsSystem == 1 && role.RoleName == "子管理员" {
623
-						items.IsSubAdmin = true
626
+					if role != nil {
627
+						if role.IsSystem == 1 && role.RoleName == "子管理员" {
628
+							items.IsSubAdmin = true
629
+						}
624 630
 					}
625 631
 				}
626 632
 			}