Browse Source

Merge branch 'bzq/dev' of eta_mini/eta_mini_crm into master

鲍自强 9 months ago
parent
commit
d48515c593
2 changed files with 11 additions and 12 deletions
  1. 8 10
      controllers/sys_role.go
  2. 3 2
      controllers/user.go

+ 8 - 10
controllers/sys_role.go

@@ -397,6 +397,14 @@ func (this *SysRoleController) SysRoleMenuAuthSave() {
 		br.Msg = "请选择菜单"
 		return
 	}
+	sysRole, err := models.GetSysRoleById(req.SysRoleId)
+	if err == nil {
+		if sysRole.SysRoleName == "admin" {
+			br.Msg = "不允许修改admin权限"
+			return
+		}
+	}
+
 	halfMap := make(map[int]struct{})
 	for _, v := range req.HalfMenuIds {
 		halfMap[v] = struct{}{}
@@ -465,16 +473,6 @@ func (this *SysRoleController) SysRoleMenuAuthList() {
 		}
 	}
 
-	sysRole, err := models.GetSysRoleById(roleId)
-	if err == nil {
-		if sysRole.SysRoleName == "admin" {
-			br.Ret = 200
-			br.Success = true
-			br.Msg = "获取成功"
-			return
-		}
-	}
-
 	order := `sort ASC, create_time DESC, sys_menu_id DESC`
 	list, e := models.GetSysMenuItemsByCondition(``, make([]interface{}, 0), []string{}, order)
 	if e != nil {

+ 3 - 2
controllers/user.go

@@ -148,7 +148,8 @@ func (this *UserController) Add() {
 	if curTime.Before(validEndTime) {
 		user.Status = 2
 	} else {
-		user.Status = 0
+		br.Msg = "有效期截至时间必须大于当前时间"
+		return
 	}
 
 	user.RealName = req.RealName
@@ -518,7 +519,7 @@ func (this *UserController) List() {
 		}
 	}
 	if sortCondition == "" {
-		sortCondition = " ORDER BY u.valid_end_time ASC"
+		sortCondition = " ORDER BY u.create_time DESC"
 	}
 
 	if sellerIdStr != "" {