Browse Source

no message

xingzai 2 years ago
parent
commit
cd62e43ba9
3 changed files with 56 additions and 10 deletions
  1. 0 10
      controllers/report.go
  2. 42 0
      models/report.go
  3. 14 0
      services/industrial_management.go

+ 0 - 10
controllers/report.go

@@ -172,16 +172,6 @@ func (this *MobileReportController) IndustryList() {
 	if currentIndex <= 0 {
 		currentIndex = 1
 	}
-
-	//if isBillboard {
-	//	if pageSize == 0 {
-	//		pageSize = utils.PageSize15
-	//	} else {
-	//		pageSize = utils.PageSize5
-	//	}
-	//	currentIndex = 1
-	//}
-
 	startSize = paging.StartIndex(currentIndex, pageSize)
 	if ChartPermissionId > 0 {
 		condition += ` AND man.chart_permission_id IN (` + strconv.Itoa(ChartPermissionId) + `)`

+ 42 - 0
models/report.go

@@ -368,3 +368,45 @@ func GetTimeLineReportIndustrialList(industrialManagementId, startSize, pageSize
 	_, err = o.Raw(sql, industrialManagementId, industrialManagementId, startSize, pageSize).QueryRows(&items)
 	return
 }
+
+type IndustrialPublishdate struct {
+	PublishDate            string `description:"发布时间"`
+	IndustrialManagementId int    `description:"产业D"`
+}
+
+//标的列表
+func GetTimeLineReportIndustrialPublishdateList(industrialIdArr []int) (items []*IndustrialPublishdate, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT
+			a.id,
+			a.article_id,
+			man_g.industrial_management_id AS industrial_management_id,
+			a.title,
+			a.publish_date 
+		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 IN(` + utils.GetOrmInReplace(len(industrialIdArr)) + `)
+		GROUP BY industrial_management_id 
+		UNION ALL
+		SELECT	
+			mmc.id,
+			0,
+			mmc.industry_id AS industrial_management_id,			
+			mmc.content AS title,
+			mm.meeting_time AS publish_data 
+		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 IN (` + utils.GetOrmInReplace(len(industrialIdArr)) + `)
+		GROUP BY industrial_management_id 
+		ORDER BY publish_date DESC  `
+	_, err = o.Raw(sql, industrialIdArr, industrialIdArr).QueryRows(&items)
+	return
+}

+ 14 - 0
services/industrial_management.go

@@ -149,6 +149,20 @@ func HandleIndustryList(list []*models.IndustrialManagement, user *models.WxUser
 		articleIdArr = append(articleIdArr, v.ArticleId)
 	}
 
+	//时间线的更新时间
+	//	maptimelineUPdateTime := make(map[int]string)
+	listtimelinePublishdate, err := models.GetTimeLineReportIndustrialPublishdateList(industrialIdArr)
+	if err != nil && err.Error() != utils.ErrNoRow() {
+		return
+	}
+	for _, v := range listtimelinePublishdate {
+		if mapUPdateTime[v.IndustrialManagementId] != "" {
+			if utils.StrTimeToTime(v.PublishDate).After(utils.StrTimeToTime(mapUPdateTime[v.IndustrialManagementId])) {
+				mapUPdateTime[v.IndustrialManagementId] = v.PublishDate
+			}
+		}
+	}
+
 	mapHistroyArticleId := make(map[int]int)
 
 	if userId > 0 {