Browse Source

查研观向5.0 主题详情文章改为不重复展示

xingzai 2 years ago
parent
commit
4097e04f86
1 changed files with 5 additions and 1 deletions
  1. 5 1
      controllers/research.go

+ 5 - 1
controllers/research.go

@@ -308,6 +308,7 @@ func (this *ResearchController) ThemeDetail() {
 
 	var itemsNull []*models.GetThemeAericleListResp
 	subjectMap := make(map[string]string)
+	articleMap := make(map[int]int)
 	for _, v := range list {
 		resp.IndustryName = v.IndustryName
 		resp.IndustrialManagementId = v.IndustrialManagementId
@@ -322,6 +323,7 @@ func (this *ResearchController) ThemeDetail() {
 		if v.FllowNum > 0 {
 			resp.IsFollw = true
 		}
+
 		if v.SubjectName == "" {
 			item := new(models.GetThemeAericleListResp)
 			item.ArticleId = v.ArticleId
@@ -333,13 +335,14 @@ func (this *ResearchController) ThemeDetail() {
 			item.Pv = v.Pv
 			item.CollectNum = v.CollectNum
 			itemsNull = append(itemsNull, item)
+
 		}
 	}
 
 	for _, v := range resp.ListSubject {
 		subjetcGroup := new(models.GetThemeAericleListBuSubjectResp)
 		for _, v2 := range list {
-			if v2.IndustrialSubjectId == v.IndustrialSubjectId {
+			if v2.IndustrialSubjectId == v.IndustrialSubjectId && articleMap[v2.ArticleId] == 0 {
 				item := new(models.GetThemeAericleListResp)
 				item.ArticleId = v2.ArticleId
 				item.Title = v2.Title
@@ -360,6 +363,7 @@ func (this *ResearchController) ThemeDetail() {
 					item.IsCollect = true
 				}
 				resp.List = append(resp.List, item)
+				articleMap[v2.ArticleId] = v2.ArticleId
 				//subjetcGroup.List = append(subjetcGroup.List, item)
 			}
 			subjetcGroup.SubjectName = v.SubjectName