浏览代码

仓库管理——管理员的逻辑修改

mainqaq 3 年前
父节点
当前提交
7c50cb3e8c
共有 1 个文件被更改,包括 17 次插入0 次删除
  1. 17 0
      controllers/secondary_order_api_contorller.go

+ 17 - 0
controllers/secondary_order_api_contorller.go 查看文件

643
 func (this *SecondaryOrderApiController) GetuserName() {
643
 func (this *SecondaryOrderApiController) GetuserName() {
644
 	adminUserInfo := this.GetAdminUserInfo()
644
 	adminUserInfo := this.GetAdminUserInfo()
645
 	viewModels, _, _ := service.GetAdminUsersAndLoginInfo(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId, 1, 100)
645
 	viewModels, _, _ := service.GetAdminUsersAndLoginInfo(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId, 1, 100)
646
+	c, _ := service.Getcreateid(adminUserInfo.CurrentOrgId)
647
+	//c.Creator
648
+	admin := []*service.AdminUserManageViewModel{} //记录当前管理员的信息
646
 	//去除禁用的角色
649
 	//去除禁用的角色
647
 	tmp := []*service.AdminUserManageViewModel{}
650
 	tmp := []*service.AdminUserManageViewModel{}
648
 	for i := 0; i < len(viewModels); i++ {
651
 	for i := 0; i < len(viewModels); i++ {
649
 		if viewModels[i].Status == 1 {
652
 		if viewModels[i].Status == 1 {
650
 			tmp = append(tmp, viewModels[i])
653
 			tmp = append(tmp, viewModels[i])
651
 		}
654
 		}
655
+		if int64(viewModels[i].AdminUserId) == c.Creator {
656
+			admin = append(admin, viewModels[i])
657
+		}
652
 	}
658
 	}
653
 	roles := service.FindRoles(adminUserInfo.CurrentOrgId)
659
 	roles := service.FindRoles(adminUserInfo.CurrentOrgId)
654
 	//去除没有权限的角色
660
 	//去除没有权限的角色
673
 			tmplist = append(tmplist, tmp[i])
679
 			tmplist = append(tmplist, tmp[i])
674
 		}
680
 		}
675
 	}
681
 	}
682
+	isappend := true //判断结果中是否添加机构创建者,true添加,false不添加
683
+	if len(tmplist) > 0 {
684
+		for i := 0; i < len(tmplist); i++ {
685
+			if int64(tmplist[i].AdminUserId) == c.Creator {
686
+				isappend = false
687
+			}
688
+		}
689
+	}
690
+	if isappend {
691
+		tmplist = append(tmplist, admin...)
692
+	}
676
 	this.ServeSuccessJSON(map[string]interface{}{
693
 	this.ServeSuccessJSON(map[string]interface{}{
677
 		"list": tmplist,
694
 		"list": tmplist,
678
 	})
695
 	})