Browse Source

no message

xingzai 2 years ago
parent
commit
124639505d
1 changed files with 22 additions and 0 deletions
  1. 22 0
      controllers/research.go

+ 22 - 0
controllers/research.go

@@ -129,6 +129,28 @@ func (this *ResearchController) CollectionList() {
 			list[k].IsCollect = true
 		}
 	}
+	var articleIds []int
+	for k, v := range list {
+		if v.MyCollectNum > 0 {
+			list[k].IsCollect = true
+		}
+		articleIds = append(articleIds, v.ArticleId)
+	}
+	//处理关联的产业
+	industrialMap, err := services.GetArticleIndustrialByArticleId(articleIds)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "获取关联的产业信息失败,GetArticleIndustrialByArticleId Err:" + err.Error()
+		return
+	}
+	for k, v := range list {
+		if len(industrialMap[v.ArticleId]) > 0 {
+			list[k].List = industrialMap[v.ArticleId]
+		} else {
+			list[k].List = make([]*models.IndustrialManagementResp, 0)
+		}
+		list[k].PublishDate = utils.StrTimeToTime(v.PublishDate).Format(utils.FormatDate) //时间字符串格式转时间格式
+	}
 	resp := new(models.ArticleCollectionLIstResp)
 	resp.List = list
 	br.Ret = 200