Ver Fonte

时间线新增产品内测报告类型

xingzai há 1 ano atrás
pai
commit
71e196474e
2 ficheiros alterados com 32 adições e 40 exclusões
  1. 0 36
      controllers/report.go
  2. 32 4
      models/report.go

+ 0 - 36
controllers/report.go

@@ -522,37 +522,6 @@ func (this *ReportController) List() {
 	}
 	if categoryId != 99999 {
 		resp := new(models.TacticsListResp)
-		//获取该产业下所对应的行业图片
-		//detail, errCategory := models.GetdetailByCategoryIdOne(categoryId)
-		//if errCategory != nil {
-		//	br.Msg = "获取信息失败"
-		//	br.ErrMsg = "获取信息失败,Err:" + errCategory.Error() + "categoryID 不存在:" + strconv.Itoa(categoryId)
-		//	return
-		//}
-		////对应行业的图片
-		//detailChartPermissionUrl, err := models.GetConfigByCode("category_chart_permissionimg_url")
-		//if err != nil {
-		//	br.Msg = "获取数据失败"
-		//	br.ErrMsg = "行业配置信息失败,Err:" + err.Error()
-		//	return
-		//}
-		//chartPermissionUrlList := strings.Split(detailChartPermissionUrl.ConfigValue, "{|}")
-		//mapChartPermission := make(map[string]string)
-		//var permissionName string
-		//var imgUrlChartPermission string
-		//for _, v := range chartPermissionUrlList {
-		//	vslice := strings.Split(v, "_")
-		//	permissionName = vslice[0]
-		//	imgUrlChartPermission = vslice[len(vslice)-1]
-		//	mapChartPermission[permissionName] = imgUrlChartPermission
-		//}
-		//total, err := models.GetReportIndustrialCount(categoryId, industrialManagementId)
-		//if err != nil {
-		//	br.Msg = "获取信息失败"
-		//	br.ErrMsg = "获取帖子总数失败,Err:" + err.Error()
-		//	return
-		//}
-
 		list, total, err := models.GetReportAndproductInteriorIndustrialList(pars, categoryId, industrialManagementId, uid, startSize, pageSize)
 		if err != nil {
 			br.Msg = "获取信息失败"
@@ -596,11 +565,6 @@ func (this *ReportController) List() {
 			if v.Resource == 2 {
 				v.PublishDate = utils.TimeRemoveHms2(v.PublishDate)
 			}
-			//if mapCategoryUrl[v.CategoryId] == "" {
-			//	if detail.ChartPermissionId == utils.YI_YAO_ID {
-			//		list[k].ImgUrlPc = utils.YI_YAO_QI_TA
-			//	}
-			//}
 		}
 
 		//resp.CategoryImgUrlPc = mapChartPermission[detail.ChartPermissionName]

+ 32 - 4
models/report.go

@@ -1110,8 +1110,17 @@ WHERE
 	WHERE
 	mm.id = mmc.meeting_id
 	AND mm.status = 1
-	AND mmc.industry_id = ? ) AS t `
-	err = o.Raw(sql, industrialManagementId, industrialManagementId).QueryRow(&count)
+	AND mmc.industry_id = ? UNION ALL
+	SELECT
+		COUNT( 1 ) count 
+	FROM
+		cygx_product_interior AS p
+		INNER JOIN cygx_product_interior_industrial_group_management AS pm 
+	WHERE
+		p.product_interior_id = pm.product_interior_id 
+		AND p.visible_range = 1 
+	AND pm.industrial_management_id = ?  ) AS t `
+	err = o.Raw(sql, industrialManagementId, industrialManagementId, industrialManagementId).QueryRow(&count)
 	return
 }
 
@@ -1126,6 +1135,7 @@ type TimeLineReportItem struct {
 	SubCategoryName string `description:"二级分类"`
 	IsRed           bool   `description:"是否标红"`
 	Readnum         int    `description:"阅读数量"`
+	Resource        int    `description:"来源类型,1:文章、2:产品内测、3:晨报点评"`
 }
 
 // 获取产业报告+晨会点评列表
@@ -1142,6 +1152,7 @@ FROM
 		a.video_url,
 		a.sub_category_name,
 		'' AS content,
+		1 AS resource,
 		( 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
@@ -1157,6 +1168,7 @@ FROM
 		'' AS video_url,
 		'时间线' AS sub_category_name,
 		mmc.content,
+		3 AS resource,
 		0  AS readnum 
 	FROM
 		cygx_morning_meeting_review_chapter AS mmc
@@ -1164,12 +1176,28 @@ FROM
 	WHERE
 		mm.id = mmc.meeting_id 
 		AND mm.STATUS = 1 
-		AND mmc.industry_id = ? 
+		AND mmc.industry_id = ? UNION ALL
+	SELECT
+		p.product_interior_id AS id,
+		p.title,
+		p.publish_time,
+		'' AS video_url,
+		'' AS sub_category_name,
+		'' AS content,
+		2 AS resource,
+		0 AS readnum 
+	FROM
+		cygx_product_interior AS p
+		INNER JOIN cygx_product_interior_industrial_group_management AS pm 
+	WHERE
+		p.product_interior_id = pm.product_interior_id 
+		AND p.visible_range = 1 
+	AND pm.industrial_management_id = ? 
 	) AS t 
 `
 	sql += ` ORDER BY 
 	t.publish_time DESC LIMIT ?,? `
-	_, err = o.Raw(sql, industrialManagementId, industrialManagementId, startSize, pageSize).QueryRows(&items)
+	_, err = o.Raw(sql, industrialManagementId, industrialManagementId, industrialManagementId, startSize, pageSize).QueryRows(&items)
 	return
 }