|
@@ -10,6 +10,7 @@ import (
|
|
|
"hongze/hongze_yb/models/tables/yb_road_video"
|
|
|
"hongze/hongze_yb/models/tables/yb_user_collection"
|
|
|
"hongze/hongze_yb/utils"
|
|
|
+ "strings"
|
|
|
"sync"
|
|
|
"time"
|
|
|
)
|
|
@@ -177,9 +178,8 @@ func GetCollectionList(userId, fromType, currPage, pageSize int, keywords string
|
|
|
pars = append(pars, fromType)
|
|
|
}
|
|
|
if keywords != "" {
|
|
|
- keywords = "%" + keywords + "%"
|
|
|
cond += ` AND title LIKE ?`
|
|
|
- pars = append(pars, keywords)
|
|
|
+ pars = append(pars, fmt.Sprint("%", keywords, "%"))
|
|
|
}
|
|
|
collectionTotal, e := yb_user_collection.GetPageListTotalByCondition(cond, pars)
|
|
|
if e != nil {
|
|
@@ -314,6 +314,10 @@ func GetCollectionList(userId, fromType, currPage, pageSize int, keywords string
|
|
|
}
|
|
|
|
|
|
// 响应列表
|
|
|
+ titlePre := `<div style="-webkit-line-clamp: 2;-webkit-box-orient: vertical;display: -webkit-box;overflow: hidden;text-overflow: ellipsis;">`
|
|
|
+ titleSuf := `</div>`
|
|
|
+ highlightPre := `<span style="color:#E3B377">`
|
|
|
+ highlightSuf := `</span>`
|
|
|
for i := range collections {
|
|
|
v := &response.CollectionList{
|
|
|
CollectionId: collections[i].CollectionID,
|
|
@@ -362,6 +366,12 @@ func GetCollectionList(userId, fromType, currPage, pageSize int, keywords string
|
|
|
default:
|
|
|
break
|
|
|
}
|
|
|
+ // 标题富文本及高亮
|
|
|
+ v.Title = fmt.Sprint(titlePre, v.Title, titleSuf)
|
|
|
+ if keywords != "" {
|
|
|
+ kw := fmt.Sprint(highlightPre, keywords, highlightSuf)
|
|
|
+ v.Title = strings.ReplaceAll(v.Title, keywords, kw)
|
|
|
+ }
|
|
|
respList = append(respList, v)
|
|
|
}
|
|
|
|