home_controller.go 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. package home
  2. import (
  3. "eta/eta_mini_ht_api/controllers"
  4. )
  5. type HomeController struct {
  6. controllers.ListController
  7. }
  8. // Search 搜索报告列表
  9. // @Description 搜索报告列表
  10. // @Success 200 {object}
  11. // @router /search [get]
  12. func (r *HomeController) Search(key string) {
  13. controllers.Wrap(&r.BaseController, func() (result *controllers.WrapData, err error) {
  14. result = r.InitWrapData("分页搜索报告列表失败")
  15. //if key == "" {
  16. // err = exception.New(exception.SearchKeyEmptyError)
  17. // r.FailedResult("分页搜索报告列表失败", result)
  18. // return
  19. //}
  20. //detailType := r.Data["detailType"].(string)
  21. //userInfo := r.Data["user"].(user.User)
  22. //pageRes := page.Page{
  23. // Current: r.PageInfo.Current,
  24. // PageSize: r.PageInfo.PageSize,
  25. //}
  26. ////获取当前可以被搜索的报告原始ID
  27. ////先要限制查询的id范围
  28. //var reportIds []int
  29. //pageRes.Total, pageRes.LatestId, reportIds, err = report.RangeSearch(key, isLogin(detailType), userInfo.Id)
  30. //if err != nil {
  31. // logger.Error("获取报告原始ID列表失败:%v", err)
  32. // r.FailedResult("分页搜索报告列表失败", result)
  33. // return
  34. //}
  35. //if len(reportIds) == 0 {
  36. // reports := new(page.PageResult)
  37. // reports.Data = []reportService.ReportDTO{}
  38. // reports.Page = pageRes
  39. // logger.Info("没有可以查询的报告列表")
  40. // r.SuccessResult("分页搜索报告列表成功", reports, result)
  41. // return
  42. //}
  43. //
  44. //if r.PageInfo.LatestId == 0 {
  45. // //pageRes.Total, pageRes.LatestId = report.SearchMaxReportId(key)
  46. // r.PageInfo.LatestId = pageRes.LatestId
  47. // r.PageInfo.Total = pageRes.Total
  48. //} else {
  49. // pageRes.LatestId = r.PageInfo.LatestId
  50. // pageRes.Total = r.PageInfo.Total
  51. //}
  52. //pageRes.TotalPage = page.TotalPages(pageRes.Total, pageRes.PageSize)
  53. //list := make([]reportService.ReportDTO, 0)
  54. //if pageRes.LatestId > 0 {
  55. // //订阅 TODO
  56. // list, err = report.SearchReportList(key, reportIds, r.PageInfo, isLogin(detailType), userInfo.Id)
  57. // if err != nil {
  58. // r.FailedResult("分页搜索报告列表失败", result)
  59. // return
  60. // }
  61. //}
  62. //reports := new(page.PageResult)
  63. //reports.Data = list
  64. //reports.Page = pageRes
  65. //r.SuccessResult("分页搜索报告列表成功", reports, result)
  66. return
  67. })
  68. }