Parcourir la source

上周、本周研究汇总展示详情

xingzai il y a 3 ans
Parent
commit
5e8383497c
3 fichiers modifiés avec 100 ajouts et 31 suppressions
  1. 48 14
      controllers/report.go
  2. 39 8
      models/minutesSummary.go
  3. 13 9
      utils/config.go

+ 48 - 14
controllers/report.go

@@ -1314,7 +1314,7 @@ func (this *ReportController) ResearchDetail() {
 		br.ErrMsg = "报告不存在,Err:" + err.Error() + "articleId:" + strconv.Itoa(articleId)
 		return
 	}
-	detail.PublishDate = utils.StrTimeToTime(detail.PublishDate).Format("2006-01-02")
+	detail.PublishDate = utils.StrTimeToTime(detail.PublishDate).Format(utils.FormatDate)
 	detail.VideoPlaySeconds = utils.Mp3Time(detail.VideoPlaySeconds)
 	listFirst, err := models.GetResearchSummarylogListFirst(articleId)
 	if err != nil {
@@ -1336,8 +1336,14 @@ func (this *ReportController) ResearchDetail() {
 				br.ErrMsg = "获取信息失败,Err:" + err.Error()
 				return
 			}
+			if v2.ChartPermissionId == utils.YanxSummaryPermissionId {
+				listSecond[k2].IcoLink = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202111/20211104/QbTGTNhD9MxYp24cJ7V5WpCN0oNl.png"
+				listSecond[k2].PermissionName = "研选纪要"
+			} else if v2.ChartPermissionId == utils.YanxViewpointPermissionId {
+				listSecond[k2].IcoLink = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202111/20211104/QbTGTNhD9MxYp24cJ7V5WpCN0oNl.png"
+				listSecond[k2].PermissionName = "研选观点"
+			}
 			if len(listThird) > 0 {
-				listSecond[k2].List = listThird
 				for k3, v3 := range listThird {
 					if v3.VideoUrl != "" {
 						listThird[k3].IsHaveVideo = true
@@ -1346,6 +1352,7 @@ func (this *ReportController) ResearchDetail() {
 						listThird[k3].ReportLink = ""
 					}
 				}
+				listSecond[k2].List = listThird
 			}
 		}
 		if len(listSecond) > 0 {
@@ -1364,11 +1371,13 @@ func (this *ReportController) ResearchDetail() {
 		} else if v.Type == "SSGS" {
 			listFirst[k].ListName = "上市公司调研纪要篇"
 			listFirst[k].IcoLink = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202111/20211101/ujHXB48I8ay9T0XoPRI7lorz7OkL.png"
-		} else {
+		} else if v.Type == "SJDP" {
 			listFirst[k].ListName = "事件点评"
 			listFirst[k].IcoLink = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202110/20211020/2a5cXafO3Iws4QcFp1bd5WPdYikV.png"
+		} else if v.Type == "YANX" {
+			listFirst[k].ListName = "研选"
+			listFirst[k].IcoLink = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202111/20211104/QbTGTNhD9MxYp24cJ7V5WpCN0oNl.png"
 		}
-
 	}
 	historyRecord := new(models.CygxReportHistoryRecord)
 	historyRecord.UserId = uid
@@ -1433,29 +1442,54 @@ func (this *ReportController) MinutesDetail() {
 		br.ErrMsg = "报告不存在,Err:" + err.Error() + "articleId:" + strconv.Itoa(articleId)
 		return
 	}
-	detail.PublishDate = utils.StrTimeToTime(detail.PublishDate).Format("2006-01-02")
+	detail.PublishDate = utils.StrTimeToTime(detail.PublishDate).Format(utils.FormatDate)
 	detail.VideoPlaySeconds = utils.Mp3Time(detail.VideoPlaySeconds)
-	listLog, err := models.GetMinutesSummarylogListAll(articleId)
+	listFirst, err := models.GetMinutesSummarylogListAll(articleId)
 	if err != nil {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取子类信息失败,Err:" + err.Error()
 		return
 	}
-	for k, v := range listLog {
-		listSonLog, err := models.GetMinutesSummarylogSonListAll(articleId, v.ChartPermissionId)
+	for k, v := range listFirst {
+		listSecond, err := models.GetMinutesSummarylogSonListSecond(articleId, v.Type)
 		if err != nil && err.Error() != utils.ErrNoRow() {
 			br.Msg = "获取信息失败"
 			br.ErrMsg = "获取信息失败,Err:" + err.Error()
 			return
 		}
-		if len(listSonLog) > 0 {
-			listLog[k].List = listSonLog
-			for k2, v2 := range listSonLog {
-				if v2.ReportLink == "0" {
-					listSonLog[k2].ReportLink = ""
+		for k2, v2 := range listSecond {
+			listThird, err := models.GetMinutesSummarylogListThird(articleId, v2.ChartPermissionId, v.Type)
+			if err != nil && err.Error() != utils.ErrNoRow() {
+				br.Msg = "获取信息失败"
+				br.ErrMsg = "获取信息失败,Err:" + err.Error()
+				return
+			}
+			if len(listThird) > 0 {
+				for k3, v3 := range listThird {
+					if v3.VideoUrl != "" {
+						listThird[k3].IsHaveVideo = true
+					}
+					if v3.ReportLink == "0" {
+						listThird[k3].ReportLink = ""
+					}
 				}
+				listSecond[k2].List = listThird
 			}
 		}
+		if len(listSecond) > 0 {
+			listFirst[k].List = listSecond
+		}
+		//`description:"类型'SDBG深度报告片篇,’CYDYJY:产业调研纪要’,’SJDP事件点评,’BZCHJH:本周晨会精华’"`
+		if v.Type == "CYDYJY" {
+			listFirst[k].ListName = "产业调研纪要"
+			listFirst[k].IcoLink = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202110/20211020/UPAdozy96z9ypzY04vi0Y3Ogqzji.png"
+		} else if v.Type == "SSGS" {
+			listFirst[k].ListName = "上市公司调研纪要篇"
+			listFirst[k].IcoLink = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202111/20211101/ujHXB48I8ay9T0XoPRI7lorz7OkL.png"
+		} else if v.Type == "YANX" {
+			listFirst[k].ListName = "研选纪要"
+			listFirst[k].IcoLink = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202111/20211104/QbTGTNhD9MxYp24cJ7V5WpCN0oNl.png"
+		}
 	}
 	historyRecord := new(models.CygxReportHistoryRecord)
 	historyRecord.UserId = uid
@@ -1467,7 +1501,7 @@ func (this *ReportController) MinutesDetail() {
 	historyRecord.CompanyName = user.CompanyName
 	historyRecord.ReportType = "szjyhz"
 	go models.AddCygxReportHistoryRecord(historyRecord)
-	resp.List = listLog
+	resp.List = listFirst
 	resp.Detail = detail
 	br.Ret = 200
 	br.Success = true

+ 39 - 8
models/minutesSummary.go

@@ -18,7 +18,7 @@ type DetailCygxMinutesSummaryRep struct {
 type MinutesSummaryLetailResp struct {
 	Detail        *DetailCygxMinutesSummaryRep
 	HasPermission int `description:"1:有该行业权限,正常展示,2:无该行业权限,不存在权益客户下,3:无该品类权限,已提交过申请,4:无该行业权限,未提交过申请,5:潜在客户,未提交过申请,6:潜在客户,已提交过申请"`
-	List          []*MinutesSummaryChartPermission
+	List          []*ResearchSummaryChartPermission
 }
 
 type MinutesSummaryChartPermission struct {
@@ -52,15 +52,20 @@ func GetCygxMinutesSummaryInfoById(articleId int) (item *DetailCygxMinutesSummar
 }
 
 //列表
-func GetMinutesSummarylogListAll(articleId int) (items []*MinutesSummaryChartPermission, err error) {
+func GetMinutesSummarylogListAll(articleId int) (items []*ResearchSummaryChartPermission, err error) {
 	o := orm.NewOrm()
-	sql := `SELECT c.permission_name ,c.image_url,l.*
-			FROM
-			cygx_minutes_summary_log AS l
-			INNER JOIN chart_permission AS c ON c.chart_permission_id = l.chart_permission_id 
+	//sql := `SELECT c.permission_name ,c.image_url,l.*
+	//		FROM
+	//		cygx_minutes_summary_log AS l
+	//		INNER JOIN chart_permission AS c ON c.chart_permission_id = l.chart_permission_id
+	//		WHERE l.article_id = ?
+	//		GROUP BY l.chart_permission_id
+	//		ORDER BY l.chart_permission_sort ASC   `
+	sql := `SELECT l.* 
+			FROM cygx_minutes_summary_log AS l 
 			WHERE l.article_id = ? 
-			GROUP BY l.chart_permission_id
-			ORDER BY l.chart_permission_sort ASC   `
+			GROUP BY l.type 
+			ORDER BY l.sort ASC`
 	_, err = o.Raw(sql, articleId).QueryRows(&items)
 	return
 }
@@ -76,3 +81,29 @@ func GetMinutesSummarylogSonListAll(articleId, chartPermissionId int) (items []*
 	_, err = o.Raw(sql, articleId, chartPermissionId).QueryRows(&items)
 	return
 }
+
+//列表
+func GetMinutesSummarylogSonListSecond(articleId int, artType string) (items []*CygxResearchSummaryLogSecond, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT c.permission_name ,c.chart_permission_id ,c.image_url, l.* 
+			FROM
+			cygx_minutes_summary_log AS l
+			LEFT JOIN chart_permission AS c ON c.chart_permission_id = l.chart_permission_id 
+			WHERE l.article_id = ? AND l.type =?
+			GROUP BY l.chart_permission_id
+			ORDER  BY l.chart_permission_sort ASC`
+	_, err = o.Raw(sql, articleId, artType).QueryRows(&items)
+	return
+}
+
+//列表
+func GetMinutesSummarylogListThird(articleId, chartPermissionId int, artType string) (items []*CygxResearchSummaryLogThird, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT  l.link_article_id,l.body ,a.video_url
+			FROM cygx_minutes_summary_log AS l
+			LEFT JOIN cygx_article as a ON a.article_id = l.link_article_id
+			WHERE l.article_id = ? AND l.type =? AND  l.chart_permission_id = ? 
+			ORDER  BY l.chart_permission_sort ASC `
+	_, err = o.Raw(sql, articleId, artType, chartPermissionId).QueryRows(&items)
+	return
+}

+ 13 - 9
utils/config.go

@@ -49,15 +49,17 @@ var (
 )
 
 var (
-	IndexName         string
-	OnlineTime        string
-	SummaryArticleId  int
-	EmailTechnology   string //科技行业专家邮箱
-	EmailMedicine     string //医药行业专家邮箱
-	EmailConsumption  string //消费行业专家邮箱
-	EmailZhizao       string //智造行业专家邮箱
-	EmailStrategy     string //策略行业专家邮箱
-	EmaiWhiteUserList string //白名单邮箱
+	IndexName                 string
+	OnlineTime                string
+	SummaryArticleId          int
+	YanxSummaryPermissionId   int    //研选纪要分类ID
+	YanxViewpointPermissionId int    //研选观点分类ID
+	EmailTechnology           string //科技行业专家邮箱
+	EmailMedicine             string //医药行业专家邮箱
+	EmailConsumption          string //消费行业专家邮箱
+	EmailZhizao               string //智造行业专家邮箱
+	EmailStrategy             string //策略行业专家邮箱
+	EmaiWhiteUserList         string //白名单邮箱
 )
 
 func init() {
@@ -83,6 +85,8 @@ func init() {
 
 	OnlineTime = "2021-06-01 00:00:01" //上线时间
 	SummaryArticleId = 1000000         //手动添加的纪要库开始ID
+	YanxSummaryPermissionId = 1001     //研选纪要分类ID
+	YanxViewpointPermissionId = 1002   //研选观点分类ID
 	WxMsgTemplateIdAskMsgMobileAll = "15557270714,18767183922,18621268829"
 	if RunMode == "release" {
 		WxAppId = "wxcc32b61f96720d2f"