瀏覽代碼

Merge branch 'cygx_12.8.1' of http://8.136.199.33:3000/hongze/hongze_task

xingzai 1 年之前
父節點
當前提交
76c42917b4
共有 1 個文件被更改,包括 87 次插入0 次删除
  1. 87 0
      services/cygx_research_summary.go

+ 87 - 0
services/cygx_research_summary.go

@@ -400,6 +400,93 @@ func CygxResearchSummary(cont context.Context) (err error) {
 		}
 	}
 
+	//事件点评 之前叫事件点评,后来改成了 市场QA汇总
+	{
+		var condition string
+		var pars []interface{}
+		condition += ` AND publish_date < ?  AND publish_date >= ? `
+		pars = append(pars, friday, lastfriday)
+		sjdpList := make([]*data_manage.CygxArticle, 0)
+
+		//科技
+		{
+			//10078:AI问答
+			newCondition := condition + ` AND category_id_two IN(10078)  `
+			list, e := data_manage.GetReportArticleList(newCondition, pars)
+			if e != nil {
+				err = e
+				fmt.Println("GetReportArticleList err:", e)
+				return
+			}
+			for _, article := range list {
+				sjdpList = append(sjdpList, article)
+			}
+		}
+
+		//医药
+		{
+			//98:N问N答
+			newCondition := condition + ` AND category_id_two IN(98) `
+			list, e := data_manage.GetReportArticleList(newCondition, pars)
+			if e != nil {
+				err = e
+				fmt.Println("GetReportArticleList err:", e)
+				return
+			}
+			for _, article := range list {
+				sjdpList = append(sjdpList, article)
+			}
+		}
+
+		var logItems []*data_manage.CygxResearchSummaryLog
+		for _, article := range sjdpList {
+			head := "<div class=\"title-content\">\n 【" + article.Title + "】    "
+			sliceSubjects := strings.Split(article.Stock, "/")
+			var company string
+			if sliceSubjects[0] != "" {
+				for _, vSubject := range sliceSubjects {
+					sliceKuohao := strings.Split(vSubject, "(")           //过滤括号
+					sliceXiahuaxian := strings.Split(sliceKuohao[0], "-") //过滤下划线
+					subject := sliceXiahuaxian[0]
+					company += "#" + subject
+				}
+				company = "    <span style=\"color: #ff1720\">" + company + "</span>"
+			}
+			annotation := strings.ReplaceAll(article.Annotation, "<strong>", "")
+			annotation = strings.ReplaceAll(annotation, "</strong>", "")
+			annotation = strings.ReplaceAll(annotation, "</ol>", "</div>")
+			annotation = strings.ReplaceAll(annotation, "<ol>", "<div>")
+			annotation = strings.ReplaceAll(annotation, "</li>", "</p>")
+			annotation = strings.ReplaceAll(annotation, "<li>", "<p>")
+			re, _ := regexp.Compile("<strong.*?>")
+			annotation = re.ReplaceAllString(annotation, "")
+			reLi, _ := regexp.Compile("<li.*?>")
+			annotation = reLi.ReplaceAllString(annotation, "")
+			logItem := data_manage.CygxResearchSummaryLog{
+				ArticleId:         int(articleId),
+				Type:              "SJDP",
+				ChartPermissionId: CategoryChartPermissionIdMap[article.CategoryIdTwo],
+				CreateTime:        time.Now(),
+				Body:              head + company + annotation,
+				LinkArticleId:     article.LinkArticleId,
+			}
+			if utils.RunMode == "debug" {
+				logItem.ReportLink = "https://clpttest.hzinsights.com/material/info/" + strconv.Itoa(article.ArticleId)
+			} else {
+				logItem.ReportLink = "https://web.hzinsights.com/material/info/" + strconv.Itoa(article.ArticleId)
+			}
+			logItems = append(logItems, &logItem)
+		}
+		if len(logItems) > 0 {
+			_, e := data_manage.AddCygxResearchSummaryLogOrm(logItems)
+			if e != nil {
+				err = e
+				return
+			}
+		}
+	}
+
+
 	//买方研选
 	//{
 	//	ids, e := data_manage.GetYanXuanArticleIdList()