|
@@ -307,28 +307,39 @@ func (this *UserController) CollectList() {
|
|
|
br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
- //listLen := len(list)
|
|
|
- //for i := 0; i < listLen; i++ {
|
|
|
- // item := list[i]
|
|
|
- // uf, err := cache.GetUserFunnyCache(userId, item.FunnyId)
|
|
|
- // if err != nil && err.Error()!=utils.ErrNoRow() {
|
|
|
- // br.Msg = "获取信息失败"
|
|
|
- // br.ErrMsg = "判断是否收藏失败,Err:" + err.Error()
|
|
|
- // return
|
|
|
- // }
|
|
|
- // if uf!=nil {
|
|
|
- // if uf.IsCollect > 0 {
|
|
|
- // list[i].IsCollect=true
|
|
|
- // }
|
|
|
- // if uf.IsComment > 0 {
|
|
|
- // list[i].IsComment=true
|
|
|
- // }
|
|
|
- // if uf.IsLike > 0 {
|
|
|
- // list[i].IsLike=true
|
|
|
- // }
|
|
|
- // }
|
|
|
- // list[i].CreateTimeStamp=list[i].CreateTime.Unix()
|
|
|
- //}
|
|
|
+ var articleIds []string
|
|
|
+ for _, v := range list {
|
|
|
+ articleIds = append(articleIds, strconv.Itoa(v.ArticleId))
|
|
|
+ }
|
|
|
+ articleIdStr := strings.Join(articleIds, ",")
|
|
|
+ articleMap := make(map[int]*models.ArticleDetail)
|
|
|
+ if articleIdStr != "" {
|
|
|
+ articleList, err := models.GetArticleDetailByIdStr(articleIdStr)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取数据失败"
|
|
|
+ br.ErrMsg = "获取报告详情信息失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ for _, v := range articleList {
|
|
|
+ if _, ok := articleMap[v.ArticleId]; !ok {
|
|
|
+ articleMap[v.ArticleId] = v
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ lenList := len(list)
|
|
|
+ for i := 0; i < lenList; i++ {
|
|
|
+ item := list[i]
|
|
|
+ article := articleMap[item.ArticleId]
|
|
|
+ list[i].Title = article.Title
|
|
|
+ list[i].TitleEn = article.TitleEn
|
|
|
+ list[i].UpdateFrequency = article.UpdateFrequency
|
|
|
+ list[i].CreateDate = article.CreateDate
|
|
|
+ list[i].PublishDate = article.PublishDate
|
|
|
+ list[i].Body = article.Body
|
|
|
+ list[i].Abstract = article.Abstract
|
|
|
+ list[i].CategoryName = article.CategoryName
|
|
|
+ list[i].SubCategoryName = article.SubCategoryName
|
|
|
+ }
|
|
|
page := paging.GetPaging(currentIndex, pageSize, total)
|
|
|
resp := new(models.ArticleCollectListResp)
|
|
|
resp.List = list
|