ziwen 1 年間 前
コミット
6c8ce62580
1 ファイル変更5 行追加1 行削除
  1. 5 1
      controllers/help_doc/classify.go

+ 5 - 1
controllers/help_doc/classify.go

@@ -55,6 +55,7 @@ func (this *HelpDocClassifyController) ListClassify() {
 	newRootList := make([]help_doc.HelpDocClassifyItems, 0)
 	//parentMap := make(map[int]int)
 	classifyAllMap := make(map[int]*help_doc.HelpDocClassifyItems, 0)
+	classifyKeyMap := make(map[int]*help_doc.HelpDocClassifyItems, 0)
 	rootMap := make(map[*help_doc.HelpDocClassifyItems]int, 0)
 	if keyWord != "" {
 		classifyAll, err = help_doc.GetAllHelpDocClassifyByKeyword("")
@@ -79,10 +80,13 @@ func (this *HelpDocClassifyController) ListClassify() {
 				ppid := classifyAllMap[v.ParentId].ParentId
 				//newRootList = append(newRootList, *classifyAllMap[ppid])
 				rootMap[classifyAllMap[ppid]] = 1
+				classifyKeyMap[v.ClassifyId] = v
+				classifyKeyMap[v.ParentId] = classifyAllMap[v.ParentId]
 			} else if v.Level == 2{
 				pid := classifyAllMap[v.ParentId].ClassifyId
 				//newRootList = append(newRootList, *classifyAllMap[pid])
 				rootMap[classifyAllMap[pid]] = 1
+				classifyKeyMap[v.ClassifyId] = v
 			} else if v.Level == 1 {
 				//newRootList = append(newRootList, *v)
 				rootMap[v] = 1
@@ -98,7 +102,7 @@ func (this *HelpDocClassifyController) ListClassify() {
 			newRootList = append(newRootList, *v)
 		}
 		// 重新组合 newClassifyAll
-		for _, v := range keywordClassify {
+		for _, v := range classifyKeyMap {
 			if v.Level != 1 {
 				newClassifyAll = append(newClassifyAll, v)
 			}