Ver código fonte

搜索调整

xiexiaoyuan 3 anos atrás
pai
commit
5e94d60654

+ 0 - 1
models/tables/report_chapter_type/report_chapter_type.go

@@ -22,7 +22,6 @@ type ReportChapterType struct {
 	PauseEndTime           time.Time      `gorm:"column:pause_end_time;type:datetime" json:"pause_end_time"`                              //暂停结束日期
 	IsSet                  int            `gorm:"column:is_set;type:tinyint(4);default:0" json:"is_set"`
 	YbIconUrl              string    `gorm:"column:yb_icon_url;type:varchar(255) json:"yb_icon_url"`                                     //研报小程序3.0图标
-	YbBottomIcon              string    `gorm:"column:yb_bottom_icon;type:varchar(255) json:"yb_bottom_icon"`                                     //研报小程序3.0底部菜单图标
 }
 
 func (r *ReportChapterType) TableName() string {

+ 2 - 2
services/elastic/report.go

@@ -122,8 +122,8 @@ func SearchReport(keyWord string, classifyIdFirsts []int, classifyIdSeconds []in
 			"Title":map[string]interface{}{},
 			"Categories":map[string]interface{}{},
 			"BodyContent":map[string]interface{}{
-				"pre_tags" : "{{highlight}}",
-				"post_tags": "{{/highlight}}",
+			//	"pre_tags" : "{{highlight}}",
+			//	"post_tags": "{{/highlight}}",
 			},
 		},
 		"pre_tags" : "<span style=\"color:#E3B377\">",

+ 9 - 11
services/report/report.go

@@ -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
 }

+ 1 - 1
services/report/report_chapter.go

@@ -299,7 +299,7 @@ func GetMenuChapter(reportId int, typeIds []int, classifyNameFirst string, repor
 					temp.ReportChapterId = item.ReportChapterId
 					temp.ReportId = item.ReportId
 					temp.ReportChapterTypeName = typeItem.ReportChapterTypeName
-					temp.ReportChapterTypeThumb = typeItem.YbBottomIcon
+					temp.ReportChapterTypeThumb = typeItem.YbIconUrl
 					temp.Sort = typeItem.Sort
 					reportTypeList = append(reportTypeList, temp)
 				}