|
@@ -424,56 +424,48 @@ func (bk *BookMarkController) BookMarkList(sourceType string) {
|
|
|
// @Description 获取收藏列表
|
|
|
// @Success 200 {object}
|
|
|
// @router /bookmark/chartList [get]
|
|
|
-func (bk *BookMarkController) ChartList() {
|
|
|
+func (bk *BookMarkController) ChartList(key string) {
|
|
|
controllers.Wrap(&bk.BaseController, func() (result *controllers.WrapData, err error) {
|
|
|
result = bk.InitWrapData("分页查询收藏列表失败")
|
|
|
userInfo := bk.Data["user"].(user.User)
|
|
|
- var list []userService.BookMarkChart
|
|
|
- list, err = getAllChartList(userInfo.Id)
|
|
|
- if err != nil {
|
|
|
- err = exception.NewWithException(exception.GetBookMarkListFailed, err.Error())
|
|
|
- bk.FailedResult("分页查询收藏列表失败", result)
|
|
|
- return
|
|
|
- }
|
|
|
- //bookMarks := new(page.PageResult)
|
|
|
- //bookMarks.Data = list
|
|
|
- bk.SuccessResult("分页查询收藏列表成功", list, result)
|
|
|
- return
|
|
|
-
|
|
|
- })
|
|
|
-}
|
|
|
-
|
|
|
-// 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)
|
|
|
+ var list []userService.BookMarkChart
|
|
|
+ list, err = getAllChartList(userInfo.Id)
|
|
|
+ if err != nil {
|
|
|
+ err = exception.NewWithException(exception.GetBookMarkListFailed, err.Error())
|
|
|
+ bk.FailedResult("分页查询收藏列表失败", result)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ //bookMarks := new(page.PageResult)
|
|
|
+ //bookMarks.Data = list
|
|
|
+ bk.SuccessResult("分页查询收藏列表成功", list, 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)
|
|
|
+ } else {
|
|
|
+ if key == "" {
|
|
|
+ err = exception.New(exception.IllegalSearchKeyword)
|
|
|
+ bk.FailedResult("分页搜索收藏列表失败", result)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ 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)
|
|
|
+ bk.SuccessResult("分页搜索收藏列表成功", bookMarkList, result)
|
|
|
return
|
|
|
}
|
|
|
- for _, chart := range chartList {
|
|
|
- bookMarkList = append(bookMarkList, ConvertToBookMarkChart(chart))
|
|
|
- }
|
|
|
- //bookMarkList, err = user.SearchBookMark(key, sourceType, sourceIds, bk.PageInfo, userInfo.Id)
|
|
|
- bk.SuccessResult("分页搜索收藏列表成功", bookMarkList, 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 {
|