xingzai 1 tahun lalu
induk
melakukan
691f791cbc
2 mengubah file dengan 15 tambahan dan 4 penghapusan
  1. 4 4
      controllers/yanxuan_special.go
  2. 11 0
      services/article.go

+ 4 - 4
controllers/yanxuan_special.go

@@ -69,10 +69,10 @@ func (this *YanxuanSpecialController) List() {
 		}
 		v.Content = utils.ArticleRemoveImgUrl(v.Content)
 
-		//v.Content, err = utils.ExtractText(v.Content)
-		//if err != nil {
-		//	return
-		//}
+		v.Content, err = utils.ExtractText(v.Content)
+		if err != nil {
+			return
+		}
 		//v.Content, _ = services.GetReportContentTextSubNew(v.Content)
 		v.Content = services.AnnotationHtml(v.Content)
 		if v.DocUrl != "" {

+ 11 - 0
services/article.go

@@ -1966,6 +1966,17 @@ func AnnotationHtml(bodyText string) (annotation string) {
 			mapSort = append(mapSort, textLen)
 		}
 	})
+
+	section := doc.Find("section")
+	section.Each(func(tk int, section *goquery.Selection) {
+		sectionText := section.Text()
+		sectionText = strings.Replace(sectionText, " ", "", -1)
+		if sectionText != "" {
+			textLen := strings.Index(docText, sectionText)
+			mapDoc[(strings.Index(docText, sectionText))] = sectionText
+			mapSort = append(mapSort, textLen)
+		}
+	})
 	if len(mapSort) == 0 {
 		return
 	} else {