|
@@ -1805,6 +1805,9 @@ func HandleArticleCategoryImg(list []*models.HomeArticle) (items []*models.HomeA
|
|
|
//处理核心观点的展示规则
|
|
|
func ArticleAnnotation(item *models.HomeArticle) (annotation string) {
|
|
|
|
|
|
+ if item.ArticleId != 7700 {
|
|
|
+ return
|
|
|
+ }
|
|
|
if item.ArticleId >= utils.SummaryArticleId {
|
|
|
item.Annotation = YxArticleAnnotation(item)
|
|
|
}
|
|
@@ -1827,16 +1830,20 @@ func ArticleAnnotation(item *models.HomeArticle) (annotation string) {
|
|
|
p := doc.Find("p")
|
|
|
p.Each(func(tk int, pd *goquery.Selection) {
|
|
|
pdText := pd.Text()
|
|
|
- textLen := strings.Index(docText, pdText)
|
|
|
- mapDoc[(strings.Index(docText, pdText))] = pdText
|
|
|
- mapSort = append(mapSort, textLen)
|
|
|
+ if pdText != "" {
|
|
|
+ textLen := strings.Index(docText, pdText)
|
|
|
+ mapDoc[(strings.Index(docText, pdText))] = pdText
|
|
|
+ mapSort = append(mapSort, textLen)
|
|
|
+ }
|
|
|
})
|
|
|
li := doc.Find("li")
|
|
|
li.Each(func(tk int, li *goquery.Selection) {
|
|
|
liText := li.Text()
|
|
|
- textLen := strings.Index(docText, liText)
|
|
|
- mapDoc[(strings.Index(docText, liText))] = strconv.Itoa(tk+1) + "." + liText
|
|
|
- mapSort = append(mapSort, textLen)
|
|
|
+ if liText != "" {
|
|
|
+ textLen := strings.Index(docText, liText)
|
|
|
+ mapDoc[(strings.Index(docText, liText))] = strconv.Itoa(tk+1) + "." + liText
|
|
|
+ mapSort = append(mapSort, textLen)
|
|
|
+ }
|
|
|
})
|
|
|
if len(mapSort) == 0 {
|
|
|
return
|
|
@@ -1846,7 +1853,7 @@ func ArticleAnnotation(item *models.HomeArticle) (annotation string) {
|
|
|
var annotationHtml string
|
|
|
for _, vSort := range mapSort {
|
|
|
for k, v := range mapDoc {
|
|
|
- if k == vSort {
|
|
|
+ if k == vSort && v != "" {
|
|
|
annotationHtml += v + "<br>"
|
|
|
}
|
|
|
}
|