Forráskód Böngészése

Merge branch 'feature/pool294_fa_calendar' into debug

xyxie 1 hónapja
szülő
commit
4aac4532e2
1 módosított fájl, 8 hozzáadás és 3 törlés
  1. 8 3
      controller/fe_calendar/fe_calendar.go

+ 8 - 3
controller/fe_calendar/fe_calendar.go

@@ -41,12 +41,15 @@ func PermissionList(c *gin.Context) {
 	}
 	parents := make([]*chart_permission.SimpleChartPermission, 0)
 	parentPermissions := make(map[int][]*chart_permission.SimpleChartPermission, 0)
+	showPermissionIds := make(map[int]struct{}, 0)
 	for _, v := range permissions {
 		if v.ParentId > 0 && utils.InArrayByInt(validPermissionIds, int(v.ChartPermissionID)) && utils.InArrayByInt(matterPermissionIds, int(v.ChartPermissionID)) {
 			if parentPermissions[v.ParentId] == nil {
 				parentPermissions[v.ParentId] = make([]*chart_permission.SimpleChartPermission, 0)
 			}
 			parentPermissions[v.ParentId] = append(parentPermissions[v.ParentId], chart_permission.FormatChartPermission2Simple(v))
+			showPermissionIds[int(v.ChartPermissionID)] = struct{}{}
+			showPermissionIds[v.ParentId] = struct{}{}
 			continue
 		}
 		parents = append(parents, chart_permission.FormatChartPermission2Simple(v))
@@ -68,9 +71,11 @@ func PermissionList(c *gin.Context) {
 		response.FailMsg("获取失败", "获取品种列表失败, Err: "+e.Error(), c)
 		return
 	}
-	if e == nil {
-		lastEditPermissionId = matter.ChartPermissionId
-		lastEditPermissionName = matter.ChartPermissionName
+	if e == nil && matter != nil && matter.FeCalendarMatterId > 0 {
+		if _, ok := showPermissionIds[matter.ChartPermissionId]; ok {
+			lastEditPermissionId = matter.ChartPermissionId
+			lastEditPermissionName = matter.ChartPermissionName
+		}
 	}
 
 	resp.CheckedPermissionId = lastEditPermissionId