|
@@ -840,7 +840,7 @@ func GetCollectReportList(user user.UserInfo, chartPermissionId, pageIndex, page
|
|
|
}
|
|
|
listMap := make(map[string]*response.ReportCollectList)
|
|
|
for _, v := range reportList {
|
|
|
- v.ContentSub = GetReportContentSub(v.ContentSub, false)
|
|
|
+ v.ContentSub = GetReportContentSub(v.ContentSub, true)
|
|
|
if _, ok := listMap[v.PublishTime.Format("2006-01-02")]; !ok {
|
|
|
temp := new(response.ReportCollectList)
|
|
|
temp.Date = v.PublishTime.Format("2006-01-02")
|
|
@@ -921,14 +921,14 @@ func SearchReport(user user.UserInfo, keyWord string, pageIndex, pageSize int)(r
|
|
|
temp.ClassifyIdSecond = reportItem.ClassifyIdSecond
|
|
|
temp.ClassifyNameSecond = reportItem.ClassifyNameSecond
|
|
|
temp.Title = reportItem.Title
|
|
|
- temp.ContentSub = html.UnescapeString(reportItem.BodyContent)
|
|
|
+ temp.ContentSub = reportItem.BodyContent
|
|
|
temp.PublishTime, err = time.Parse("2006-01-02 15:04:05", reportItem.PublishTime)
|
|
|
|
|
|
if len(v.Highlight["Title"]) > 0 {
|
|
|
temp.Title = v.Highlight["Title"][0]
|
|
|
}
|
|
|
if len(v.Highlight["BodyContent"]) > 0 {
|
|
|
- temp.ContentSub = html.UnescapeString(v.Highlight["BodyContent"][0])
|
|
|
+ temp.ContentSub = v.Highlight["BodyContent"][0]
|
|
|
}
|
|
|
if len(v.Highlight["Categories"]) > 0 {
|
|
|
if temp.ClassifyNameSecond != "" {
|
|
@@ -938,7 +938,7 @@ func SearchReport(user user.UserInfo, keyWord string, pageIndex, pageSize int)(r
|
|
|
temp.ClassifyNameFirst = "<span style=\"color:#E3B377\">"+temp.ClassifyNameFirst+"</span>"
|
|
|
}
|
|
|
}
|
|
|
- temp.ContentSub = GetReportContentSub(temp.ContentSub, true)
|
|
|
+ temp.ContentSub = GetReportContentSub(temp.ContentSub, false)
|
|
|
reportList = append(reportList, temp)
|
|
|
}
|
|
|
}
|
|
@@ -1031,13 +1031,11 @@ func GetTickerData(user user.UserInfo, reportChapterId int) (ret *response.Ticke
|
|
|
}
|
|
|
|
|
|
// GetReportContentSub 特殊处理contentSub
|
|
|
-func GetReportContentSub(content string, highlight bool) (contentSub string) {
|
|
|
- content = html.UnescapeString(content)
|
|
|
- contentSub = utils.TrimHtml(content)
|
|
|
- if highlight {
|
|
|
- contentSub = strings.ReplaceAll(contentSub, "{{highlight}}", "<span style=\"color:#E3B377\">")
|
|
|
- contentSub = strings.ReplaceAll(contentSub, "{{/highlight}}", "</span>")
|
|
|
+func GetReportContentSub(content string, scapeFlag bool) (contentSub string) {
|
|
|
+ if scapeFlag {
|
|
|
+ content = html.UnescapeString(content)
|
|
|
+ content = utils.TrimHtml(content) //只展示纯文本
|
|
|
}
|
|
|
- contentSub = "<div style=\"-webkit-line-clamp: 3;-webkit-box-orient: vertical;display: -webkit-box;overflow: hidden;text-overflow: ellipsis;\">"+contentSub+"</div>"
|
|
|
+ contentSub = "<div style=\"-webkit-line-clamp: 3;-webkit-box-orient: vertical;display: -webkit-box;overflow: hidden;text-overflow: ellipsis;\">"+content+"</div>"
|
|
|
return
|
|
|
}
|