ソースを参照

核心观点解析样式添加优化

xingzai 2 年 前
コミット
e61545e9ec
2 ファイル変更14 行追加5 行削除
  1. 1 4
      controllers/chart.go
  2. 13 1
      services/article.go

+ 1 - 4
controllers/chart.go

@@ -2,7 +2,6 @@ package controllers
 
 import (
 	"encoding/json"
-	"fmt"
 	"github.com/rdlucklib/rdluck_tools/paging"
 	"hongze/hongze_cygx/models"
 	"hongze/hongze_cygx/services"
@@ -89,7 +88,6 @@ func (this *ChartController) Collection() {
 	var listCollection []*models.HomeChartListResp
 	var total int
 	//var err error
-	fmt.Println(user)
 	chartUserTokenByMobile, _ := services.GetUserTokenByMobile(mobile)
 	if chartUserTokenByMobile != "" {
 		list, err, _ := services.GetChartCollectionByApi(mobile, 9999, 0)
@@ -98,7 +96,6 @@ func (this *ChartController) Collection() {
 			br.ErrMsg = "获取图表分类失败 Err:" + err.Error()
 			return
 		}
-		fmt.Println(len(list))
 		var chartIds string
 		var condition string
 		var pars []interface{}
@@ -448,7 +445,7 @@ func (this *ChartController) Jidu() {
 	var total int
 	var err error
 	chartUserTokenByMobile, _ := services.GetUserTokenByMobile(mobile)
-	chartIds := "5424,5422,5423,5426"
+	chartIds := "5424,5587,5423,5589"
 	if chartUserTokenByMobile != "" {
 		var condition string
 		var pars []interface{}

+ 13 - 1
services/article.go

@@ -1812,7 +1812,6 @@ func ArticleAnnotation(item *models.HomeArticle) (annotation string) {
 	} else {
 		return
 	}
-
 	bodyText, _ := GetReportContentTextSubNew(annotation)
 	if bodyText == "" {
 		return
@@ -1826,6 +1825,7 @@ func ArticleAnnotation(item *models.HomeArticle) (annotation string) {
 		p := doc.Find("p")
 		p.Each(func(tk int, pd *goquery.Selection) {
 			pdText := pd.Text()
+			pdText = strings.Replace(pdText, " ", "", -1)
 			if pdText != "" {
 				textLen := strings.Index(docText, pdText)
 				mapDoc[(strings.Index(docText, pdText))] = pdText
@@ -1835,12 +1835,24 @@ func ArticleAnnotation(item *models.HomeArticle) (annotation string) {
 		li := doc.Find("li")
 		li.Each(func(tk int, li *goquery.Selection) {
 			liText := li.Text()
+			liText = strings.Replace(liText, " ", "", -1)
 			if liText != "" {
 				textLen := strings.Index(docText, liText)
 				mapDoc[(strings.Index(docText, liText))] = strconv.Itoa(tk+1) + "." + liText
 				mapSort = append(mapSort, textLen)
 			}
 		})
+
+		ul := doc.Find("ul")
+		ul.Each(func(tk int, ul *goquery.Selection) {
+			ulText := ul.Text()
+			ulText = strings.Replace(ulText, " ", "", -1)
+			if ulText != "" {
+				textLen := strings.Index(docText, ulText)
+				mapDoc[(strings.Index(docText, ulText))] = strconv.Itoa(tk+1) + "." + ulText
+				mapSort = append(mapSort, textLen)
+			}
+		})
 		if len(mapSort) == 0 {
 			return
 		} else {