|
@@ -180,8 +180,9 @@ func (bk *BookMarkController) BookMarkSearch(key string) {
|
|
|
var userRiskStatus string
|
|
|
pageRes.Total, pageRes.LatestId, reportIds, _, mappingRiskLevel, userRiskStatus, err = report.RangeSearch(key, true, userInfo.Id)
|
|
|
if err != nil {
|
|
|
- logger.Error("获取报告原始ID列表失败:%v", err)
|
|
|
- bk.FailedResult("分页搜索报告列表失败", result)
|
|
|
+ logger.Error("搜索收藏列表失败%v", err)
|
|
|
+ err = exception.NewWithException(exception.GetBookMarkListFailed, err.Error())
|
|
|
+ bk.FailedResult("分页搜索收藏列表失败", result)
|
|
|
return
|
|
|
}
|
|
|
if len(reportIds) == 0 {
|
|
@@ -222,8 +223,8 @@ type BookMarkListReq struct {
|
|
|
SourceType string `json:"source_type"`
|
|
|
}
|
|
|
|
|
|
-// SearchBookMark 获取收藏列表
|
|
|
-// @Description 获取收藏列表
|
|
|
+// SearchBookMark 搜索收藏列表
|
|
|
+// @Description 搜索收藏列表
|
|
|
// @Success 200 {object}
|
|
|
// @router /searchBookMark [get]
|
|
|
func (bk *BookMarkController) SearchBookMark(sourceType string, key string) {
|
|
@@ -246,6 +247,12 @@ func (bk *BookMarkController) SearchBookMark(sourceType string, key string) {
|
|
|
userInfo := bk.Data["user"].(user.User)
|
|
|
var sourceIds []int
|
|
|
pageRes.Total, sourceIds, err = user.GetTotalBookMarkPageBySourceType(userInfo.Id, sourceType)
|
|
|
+ if err != nil {
|
|
|
+ logger.Error("获取收藏列表失败%v", err)
|
|
|
+ err = exception.NewWithException(exception.GetBookMarkListFailed, err.Error())
|
|
|
+ bk.FailedResult("分页查询收藏列表失败", result)
|
|
|
+ return
|
|
|
+ }
|
|
|
//隐藏品种信息未设置风险等级的报告
|
|
|
if sourceType == Report {
|
|
|
pageRes.Total, sourceIds, err = report.FilterReportIds(sourceIds)
|
|
@@ -359,6 +366,12 @@ func (bk *BookMarkController) BookMarkList(sourceType string) {
|
|
|
userInfo := bk.Data["user"].(user.User)
|
|
|
var sourceIds []int
|
|
|
pageRes.Total, sourceIds, err = user.GetTotalBookMarkPageBySourceType(userInfo.Id, sourceType)
|
|
|
+ if err != nil {
|
|
|
+ logger.Error("获取收藏列表失败%v", err)
|
|
|
+ err = exception.NewWithException(exception.GetBookMarkListFailed, err.Error())
|
|
|
+ bk.FailedResult("分页查询收藏列表失败", result)
|
|
|
+ return
|
|
|
+ }
|
|
|
//隐藏品种信息未设置风险等级的报告
|
|
|
if sourceType == Report {
|
|
|
pageRes.Total, sourceIds, err = report.FilterReportIds(sourceIds)
|
|
@@ -430,6 +443,39 @@ func (bk *BookMarkController) ChartList() {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+// SearchChartList 获取搜索关键字的收藏列表
|
|
|
+// @Description 获取搜索关键字的收藏列表
|
|
|
+// @Success 200 {object}
|
|
|
+// @router /bookmark/search/chartList [get]
|
|
|
+func (bk *BookMarkController) SearchChartList(key string) {
|
|
|
+ controllers.Wrap(&bk.BaseController, func() (result *controllers.WrapData, err error) {
|
|
|
+ result = bk.InitWrapData("分页搜索收藏列表失败")
|
|
|
+ if key == "" {
|
|
|
+ err = exception.New(exception.IllegalSearchKeyword)
|
|
|
+ bk.FailedResult("分页搜索收藏列表失败", result)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ userInfo := bk.Data["user"].(user.User)
|
|
|
+ var sourceIds []int
|
|
|
+ _, sourceIds, err = user.GetTotalBookMarkPageBySourceType(userInfo.Id, Chart)
|
|
|
+ var bookMarkList []userService.BookMarkInterface
|
|
|
+ chartList, chartErr := chartService.SearchAllChartList(key, sourceIds)
|
|
|
+ if chartErr != nil {
|
|
|
+ logger.Error("搜索研报列表失败%v", err)
|
|
|
+ err = exception.NewWithException(exception.GetBookMarkListFailed, chartErr.Error())
|
|
|
+ bk.FailedResult("分页搜索收藏列表失败", result)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ for _, chart := range chartList {
|
|
|
+ bookMarkList = append(bookMarkList, ConvertToBookMarkChart(chart))
|
|
|
+ }
|
|
|
+ //bookMarkList, err = user.SearchBookMark(key, sourceType, sourceIds, bk.PageInfo, userInfo.Id)
|
|
|
+ bookMarks := new(page.PageResult)
|
|
|
+ bookMarks.Data = bookMarkList
|
|
|
+ bk.SuccessResult("分页搜索收藏列表成功", bookMarks, result)
|
|
|
+ return
|
|
|
+ })
|
|
|
+}
|
|
|
func getReportList(info page.PageInfo, templateUserId int, sourceIds []int) (list []userService.BookMarkReport, err error) {
|
|
|
sourceIds, err = userService.GetBookMarkPageRangeBySourceType(templateUserId, info, Report, sourceIds)
|
|
|
if err != nil {
|