|
@@ -254,27 +254,18 @@ func (bk *BookMarkController) SearchBookMark(sourceType string, key string) {
|
|
|
}
|
|
|
pageRes.Total = bk.PageInfo.Total
|
|
|
pageRes.TotalPage = page.TotalPages(pageRes.Total, pageRes.PageSize)
|
|
|
- var bookMarkList userService.BookMarkInterface
|
|
|
+ var bookMarkList []userService.BookMarkInterface
|
|
|
bookMarkList, err = user.SearchBookMark(key, sourceType, sourceIds, bk.PageInfo, userInfo.Id)
|
|
|
- switch sourceType {
|
|
|
- case Chart:
|
|
|
- var list []userService.BookMarkChart
|
|
|
- list, err = getChartList(bk.PageInfo, userInfo.Id)
|
|
|
- if err != nil {
|
|
|
- err = exception.NewWithException(exception.GetBookMarkListFailed, err.Error())
|
|
|
- bk.FailedResult("分页查询收藏列表失败", result)
|
|
|
- return
|
|
|
- }
|
|
|
- bookMarks := new(page.PageResult)
|
|
|
- bookMarks.Data = list
|
|
|
- bookMarks.Page = pageRes
|
|
|
- bk.SuccessResult("分页查询收藏列表成功", bookMarks, result)
|
|
|
- return
|
|
|
- default:
|
|
|
- err = exception.New(exception.IllegalSourceType)
|
|
|
- bk.FailedResult("分页查询收藏列表失败", result)
|
|
|
+ if err != nil {
|
|
|
+ err = exception.New(exception.BookMarkListFailed)
|
|
|
+ bk.FailedResult("分页搜索收藏列表失败", result)
|
|
|
return
|
|
|
}
|
|
|
+ bookMarks := new(page.PageResult)
|
|
|
+ bookMarks.Data = bookMarkList
|
|
|
+ bookMarks.Page = pageRes
|
|
|
+ bk.SuccessResult("分页搜索收藏列表成功", bookMarks, result)
|
|
|
+ return
|
|
|
})
|
|
|
}
|
|
|
|