xingzai 2 ani în urmă
părinte
comite
abb48795f9
1 a modificat fișierele cu 8 adăugiri și 2 ștergeri
  1. 8 2
      services/article.go

+ 8 - 2
services/article.go

@@ -1710,7 +1710,7 @@ func HandleArticleCategoryImg(list []*models.HomeArticle) (items []*models.HomeA
 				list[k].BodyHtml = imgurl
 			}
 		}
-		//如果文章一开始的内容是图片,优先展示第一张图片
+
 		//newBody, _ := GetReportContentTextSubByarticle(item.Body, item.Annotation, item.ArticleId)
 		list[k].Annotation = ArticleAnnotation(item)
 		list[k].Body = ""
@@ -1727,11 +1727,12 @@ func HandleArticleCategoryImg(list []*models.HomeArticle) (items []*models.HomeA
 		} else {
 			list[k].ImgUrlPc = mapCategoryUrl[v.CategoryId]
 		}
+		list[k].ArticleResponse = 4 //  默认展示核心观点
 		//ArticleResponse     int                  `description:"报告类型 0:啥也不是,1研选报告,2:研选纪要,3:研选沙龙,4;核心观点"`
 		if list[k].ArticleId >= utils.SummaryArticleId {
 			list[k].HttpUrl = utils.StrategyPlatform + strconv.Itoa(v.ArticleId)
 			list[k].IsNeedJump = true
-			list[k].ArticleResponse = 4 //  默认展示核心观点
+
 			if v.IsReport == 1 {
 				list[k].ArticleResponse = 1
 			} else if v.ArticleTypeName == "纪要" {
@@ -1860,6 +1861,11 @@ func ArticleAnnotation(item *models.HomeArticle) (annotation string) {
 
 //解析研选内容中的核心观点
 func YxArticleAnnotation(article *models.HomeArticle) (annotation string) {
+	//如果不规范,就获取内容主体
+	if strings.Count("<hr", article.Body) == 0 {
+		annotation, _ = GetReportContentTextSub(article.Body)
+		return
+	}
 	body := strings.ReplaceAll(article.Body, "<strong>", "")
 	body = strings.ReplaceAll(body, "</strong>", "")
 	body = strings.ReplaceAll(body, "</ol>", "</div>")