Selaa lähdekoodia

Merge branch 'cygx_12.1' of http://8.136.199.33:3000/hongze/hongze_cygx into debug

xingzai 1 vuosi sitten
vanhempi
commit
60973e7fea
3 muutettua tiedostoa jossa 27 lisäystä ja 5 poistoa
  1. 6 5
      controllers/yanxuan_special.go
  2. 4 0
      models/questionnaire_vote.go
  3. 17 0
      services/article.go

+ 6 - 5
controllers/yanxuan_special.go

@@ -69,11 +69,12 @@ func (this *YanxuanSpecialController) List() {
 		}
 		v.Content = utils.ArticleRemoveImgUrl(v.Content)
 
-		v.Content, err = utils.ExtractText(v.Content)
-		if err != nil {
-			return
-		}
-		v.Content, _ = services.GetReportContentTextSubNew(v.Content)
+		//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 != "" {
 			var docs []models.Doc
 			err := json.Unmarshal([]byte(v.DocUrl), &docs)

+ 4 - 0
models/questionnaire_vote.go

@@ -75,6 +75,10 @@ func AddCygxQuestionnaireVote(voteItems []*CygxQuestionnaireVote, otherItem *Cyg
 		if err != nil {
 			return
 		}
+
+		//更新其他主题投票数量
+		sql := ` UPDATE cygx_questionnaire SET other_theme_total =  other_theme_total +1 WHERE questionnaire_id = ?  `
+		_, err = o.Raw(sql, otherItem.QuestionnaireId).Exec()
 	}
 	//主题ID提交问卷需要写入的信息
 	for _, v := range voteItems {

+ 17 - 0
services/article.go

@@ -1930,6 +1930,12 @@ func ArticleAnnotation(item *models.HomeArticle) (annotation string) {
 	return
 }
 
+//func init() {
+//	strss := AnnotationHtml("")
+//
+//	fmt.Println(strss)
+//}
+
 // 处理核心观点的展示规则
 func AnnotationHtml(bodyText string) (annotation string) {
 	if bodyText == "" {
@@ -1972,6 +1978,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 {