Browse Source

Merge branch 'yb11.1' into debug

ziwen 2 years ago
parent
commit
c03d08ee27
1 changed files with 30 additions and 14 deletions
  1. 30 14
      services/report/report.go

+ 30 - 14
services/report/report.go

@@ -1213,7 +1213,7 @@ func GetReportPptImgListByReportIdAndReportChapterId(reportId, reportChapterId i
 }
 
 // GetVarietyReportList 大宗商品报告列表
-func GetVarietyReportList(user user.UserInfo, classifyId, chartPermissionId, pageIndex, pageSize int) (ret *response.ReportVarietyResp, err error) {
+func GetVarietyReportList(user user.UserInfo, classifyId, chartPermissionId, pageIndex, pageSize int) (ret *response.ReportList, err error) {
 	var errMsg string
 	defer func() {
 		if err != nil {
@@ -1293,6 +1293,10 @@ func GetVarietyReportList(user user.UserInfo, classifyId, chartPermissionId, pag
 		}
 	}
 
+	listImgMap := make(map[int]string, 0)
+	for i := 0; i < len(classifyChild); i++ {
+		listImgMap[classifyChild[i].Id] = classifyChild[i].YbListImg
+	}
 
 	// 获取有效的权限id列表
 	var validPermissionIdList []int
@@ -1342,32 +1346,44 @@ func GetVarietyReportList(user user.UserInfo, classifyId, chartPermissionId, pag
 			}
 		}
 	}
-	var list []*response.VarietyReportItem
+	var list []*response.ReportListItem
 	for _, r := range reportList {
-		item := response.VarietyReportItem{
+		// 封面图-默认取二级分类的图片,二级分类图片没有(如晨周报)则取一级
+		coverImg := listImgMap[r.ClassifyIdSecond]
+		if coverImg == "" {
+			coverImg = listImgMap[r.ClassifyIdFirst]
+		}
+		var VideoList []*response.VideoListItem
+		videoItem := response.VideoListItem{
+			VideoUrl:         r.VideoUrl,
+			VideoName:        r.VideoName,
+			VideoPlaySeconds: r.VideoPlaySeconds,
+			VideoImg:         coverImg,
+		}
+		VideoList = append(VideoList, &videoItem)
+		stageStr := r.StageStr
+		if stageStr == "" {
+			stageStr = strconv.Itoa(r.Stage)
+		}
+		item := response.ReportListItem{
 			ReportId:           r.Id,
+			ClassifyIdFirst:    r.ClassifyIdFirst,
 			ClassifyNameFirst:  r.ClassifyNameFirst,
+			ClassifyIdSecond:   r.ClassifyIdSecond,
 			ClassifyNameSecond: r.ClassifyNameSecond,
 			Title:              r.Title,
 			Abstract:           r.Abstract,
 			Author:             r.Author,
-			Frequency:          r.Frequency,
+			ReportImgUrl:       coverImg,
 			PublishTime:        r.PublishTime,
 			Stage:              r.Stage,
-			Content:            r.Content,
-			VideoUrl:           r.VideoUrl,
-			VideoName:          r.VideoName,
-			VideoSize:          r.VideoSize,
-			VideoPlaySeconds:   r.VideoPlaySeconds,
-			VideoImg:           r.VideoUrl,
-			ContentSub:         r.ContentSub,
-			BannerUrl:          r.VideoUrl,
-			ShareBgImg:         r.Title,
+			VideoList:          VideoList,
 			AuthOk:             authOk,
+			TitleInfo:          fmt.Sprintf("【第%s期|FICC|%s】", stageStr, r.ClassifyNameSecond),
 		}
 		list = append(list, &item)
 	}
-	ret = new(response.ReportVarietyResp)
+	ret = new(response.ReportList)
 	ret.List = list
 	ret.Paging = response.GetPaging(pageIndex, pageSize, int(total))
 	return