xingzai 2 rokov pred
rodič
commit
5ae0f1738d
3 zmenil súbory, kde vykonal 72 pridanie a 22 odobranie
  1. 10 14
      controllers/report.go
  2. 60 6
      models/report.go
  3. 2 2
      services/article_red.go

+ 10 - 14
controllers/report.go

@@ -1286,11 +1286,11 @@ func (this *MobileReportController) Timeline() {
 	}
 	startSize = paging.StartIndex(currentIndex, pageSize)
 	var total int
-	resp := new(models.TacticsListResp)
+	resp := new(models.TacticsListTimeResp)
 	page := paging.GetPaging(currentIndex, pageSize, total)
-	list := make([]*models.HomeArticle, 0)
+	list := make([]*models.TimeLineReportItem, 0)
 	var err error
-	list, total, err = models.GetTimeLineReportIndustrialList(industrialManagementId, startSize, pageSize)
+	list, total, err = models.GetTimeLineReportIndustrialListTime(user.UserId, industrialManagementId, startSize, pageSize)
 	if err != nil {
 		br.Msg = "获取信息失败"
 		br.ErrMsg = "获取产业报告+晨会点评列表,Err:" + err.Error()
@@ -1312,17 +1312,8 @@ func (this *MobileReportController) Timeline() {
 			return
 		}
 	}
-	//lenList := len(list)
+
 	for k, v := range list {
-		item := v
-		list[k].Body = ""
-		list[k].Abstract, _ = services.GetReportContentTextSub(item.Abstract)
-		list[k].Annotation, _ = services.GetReportContentTextSub(item.Annotation)
-		list[k].PublishDate = utils.StrTimeToTime(item.PublishDate).Format(utils.FormatDate) //时间字符串格式转时间格式
-		//行业比较研究、资金流向,显示报告的摘要
-		if resp.MatchTypeName == "行业比较研究" || resp.MatchTypeName == "资金流向" {
-			list[k].Annotation = list[k].Abstract
-		}
 		if v.SubCategoryName != "时间线" && v.Readnum == 0 && user.CreatedTime.Before(utils.StrTimeToTime(v.PublishDate)) && utils.StrTimeToTime(utils.OnlineTime).Before(utils.StrTimeToTime(v.PublishDate)) {
 			list[k].IsRed = true
 		}
@@ -1335,9 +1326,14 @@ func (this *MobileReportController) Timeline() {
 		if v.SubCategoryName == "时间线" && timeLineRed {
 			list[k].IsRed = true
 		}
+		if v.VideoUrl != "" {
+			list[k].IsHaveVideo = true
+		}
+
 	}
+
 	if len(list) == 0 {
-		list = make([]*models.HomeArticle, 0)
+		list = make([]*models.TimeLineReportItem, 0)
 	}
 	page = paging.GetPaging(currentIndex, pageSize, total)
 	resp.List = list

+ 60 - 6
models/report.go

@@ -52,6 +52,13 @@ type TacticsListResp struct {
 	List             []*HomeArticle
 }
 
+type TacticsListTimeResp struct {
+	Paging           *paging.PagingItem
+	MatchTypeName    string `description:"匹配类型"`
+	CategoryImgUrlPc string `description:"图片"`
+	List             []*TimeLineReportItem
+}
+
 // 报告搜索start
 type ReoprtSearchResp struct {
 	Paging *paging.PagingItem
@@ -417,9 +424,10 @@ func GetTimeLineReportIndustrialList(industrialManagementId, startSize, pageSize
 }
 
 type TimeLineReportItem struct {
-	Id              int    `description:"文章或晨报点评id"`
-	Title           string `description:"标题"`
-	PublishTime     string `description:"发布时间"`
+	Id    int    `description:"文章或晨报点评id"`
+	Title string `description:"标题"`
+	//PublishTime     string `description:"发布时间"`
+	PublishDate     string `description:"发布时间"`
 	Content         string `description:"内容"`
 	VideoUrl        string `description:"视频链接"`
 	IsHaveVideo     bool   `description:"是否包含视频"`
@@ -429,6 +437,52 @@ type TimeLineReportItem struct {
 	Readnum         int    `description:"阅读数量"`
 }
 
+// 获取产业报告+晨会点评列表
+func GetTimeLineReportIndustrialListTime(userId, industrialManagementId, startSize, pageSize int) (items []*TimeLineReportItem, total int, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT
+	* 
+FROM
+	(
+		SELECT
+		a.article_id AS id,
+		a.title,
+		a.publish_date,
+		a.video_url,
+		a.sub_category_name,
+		'' AS content,
+		( SELECT COUNT( 1 ) FROM cygx_article_history_record AS rec WHERE rec.user_id = ` + strconv.Itoa(userId) + ` AND rec.article_id = a.article_id ) AS readnum 
+	FROM
+		cygx_article AS a
+		INNER JOIN cygx_industrial_article_group_management AS man_g ON man_g.article_id = a.article_id 
+	WHERE
+		a.publish_status = 1 
+		AND a.is_class = 1 
+		AND man_g.industrial_management_id = ? GROUP BY id UNION ALL
+	SELECT
+		mmc.id,
+		'' AS title,
+		mm.publish_time AS publish_date,
+		'' AS video_url,
+		'时间线' AS sub_category_name,
+		mmc.content,
+		0  AS readnum 
+	FROM
+		cygx_morning_meeting_review_chapter AS mmc
+		INNER JOIN cygx_morning_meeting_reviews AS mm 
+	WHERE
+		mm.id = mmc.meeting_id 
+		AND mm.STATUS = 1 
+		AND mmc.industry_id = ? 
+	) AS t`
+	totalSql := `SELECT COUNT(1) total FROM (` + sql + `) z `
+	err = o.Raw(totalSql, industrialManagementId, industrialManagementId).QueryRow(&total)
+	sql += ` ORDER BY 
+	t.publish_date DESC LIMIT ?,? `
+	_, err = o.Raw(sql, industrialManagementId, industrialManagementId, startSize, pageSize).QueryRows(&items)
+	return
+}
+
 // 获取产业报告+晨会点评列表
 func GetTimeLineReportIndustrialListRed(userId, industrialManagementId, startSize, pageSize int) (items []*TimeLineReportItem, err error) {
 	o := orm.NewOrm()
@@ -439,7 +493,7 @@ FROM
 		SELECT
 		a.article_id AS id,
 		a.title,
-		a.publish_date AS publish_time,
+		a.publish_date ,
 		a.video_url,
 		a.sub_category_name,
 		'' AS content,
@@ -454,7 +508,7 @@ FROM
 	SELECT
 		mmc.id,
 		'' AS title,
-		mm.publish_time AS publish_time,
+		mm.publish_time AS publish_date,
 		'' AS video_url,
 		'时间线' AS sub_category_name,
 		mmc.content,
@@ -469,7 +523,7 @@ FROM
 	) AS t 
 `
 	sql += ` ORDER BY 
-	t.publish_time DESC LIMIT ?,? `
+	t.publish_date DESC LIMIT ?,? `
 	_, err = o.Raw(sql, industrialManagementId, industrialManagementId, startSize, pageSize).QueryRows(&items)
 	return
 }

+ 2 - 2
services/article_red.go

@@ -37,10 +37,10 @@ func GetShowTimeLineIsRed(user *models.WxUserItem, industrialManagementId int) (
 	}
 
 	for _, v := range timeLineList {
-		if v.Readnum == 0 && user.CreatedTime.Before(utils.StrTimeToTime(v.PublishTime)) && utils.StrTimeToTime(utils.OnlineTime).Before(utils.StrTimeToTime(v.PublishTime)) {
+		if v.Readnum == 0 && user.CreatedTime.Before(utils.StrTimeToTime(v.PublishDate)) && utils.StrTimeToTime(utils.OnlineTime).Before(utils.StrTimeToTime(v.PublishDate)) {
 			if v.SubCategoryName == "时间线" {
 				haveMorningMeeting = true
-				morningMeetingTime = v.PublishTime
+				morningMeetingTime = v.PublishDate
 				continue
 			}
 			timeLineItem.IsRed = true