瀏覽代碼

过滤富文本多余字段

xingzai 3 年之前
父節點
當前提交
e4a2561d3e
共有 3 個文件被更改,包括 5 次插入0 次删除
  1. 1 0
      controllers/article.go
  2. 3 0
      controllers/search.go
  3. 1 0
      models/search.go

+ 1 - 0
controllers/article.go

@@ -87,6 +87,7 @@ func (this *ArticleController) Detail() {
 			return
 		}
 		detail.Body = html.UnescapeString(detail.Body)
+		detail.Body = strings.Replace(detail.Body, "<p data-f-id=\"pbf\" style=\"text-align: center; font-size: 14px; margin-top: 30px; opacity: 0.65; font-family: sans-serif;\">Powered by <a href=\"https://www.froala.com/wysiwyg-editor?pb=1\" title=\"Froala Editor\">Froala Editor</a></p>", "", -1)
 		detail.Body = strings.Replace(detail.Body, "pre", "div", -1)
 		//detail.Abstract = html.UnescapeString(detail.Abstract)
 		detail.Abstract, _ = services.GetReportContentTextSub(detail.Abstract)

+ 3 - 0
controllers/search.go

@@ -115,6 +115,9 @@ func (this *SearchController) SearchList() {
 		keyWordItem.CreateTime = time.Now()
 		go models.AddSearchKeyWord(keyWordItem)
 	}
+	for k, _ := range result {
+		result[k].ImgUrlPc = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202112/20211206/UvMadc63MLZY6rnQZQgGZAFXkqwf.png"
+	}
 	resp := new(models.SearchResp)
 	page := paging.GetPaging(currentIndex, pageSize, int(total))
 	resp.Paging = page

+ 1 - 0
models/search.go

@@ -11,6 +11,7 @@ type SearchItem struct {
 	Title            string   `description:"标题"`
 	PublishDate      string   `description:"发布时间"`
 	ExpertBackground string   `description:"专家背景"`
+	ImgUrlPc         string   `description:"图片链接"`
 }
 
 type CategoryItem struct {