Jelajahi Sumber

ES搜索分页,报告搜索、资源包搜索接口

xingzai 2 tahun lalu
induk
melakukan
bdacca3819
1 mengubah file dengan 9 tambahan dan 2 penghapusan
  1. 9 2
      controllers/report.go

+ 9 - 2
controllers/report.go

@@ -945,6 +945,7 @@ func (this *MobileReportController) SearchResource() {
 // @Param   KeyWord   query   string  true       "搜索关键词"
 // @Param   PageSize   query   int  true       "每页数据条数"
 // @Param   CurrentIndex   query   int  true       "当前页页码,从1开始"
+// @Param   SearchType   query   int  true       "1:综合,2:全部"
 // @Success 200 {object} models.SearchReportAndResourceResp
 // @router /searchReportAndResource [get]
 func (this *MobileReportController) SearchReportAndResource() {
@@ -963,6 +964,7 @@ func (this *MobileReportController) SearchReportAndResource() {
 	keyWord := this.GetString("KeyWord")
 	pageSize, _ := this.GetInt("PageSize")
 	currentIndex, _ := this.GetInt("CurrentIndex")
+	searchType, _ := this.GetInt("SearchType")
 	var total int
 	var startSize int
 	if pageSize <= 0 {
@@ -1010,8 +1012,13 @@ func (this *MobileReportController) SearchReportAndResource() {
 	var conditionOr string
 	conditionOr += ` OR ( m.subject_names LIKE '%` + keyWord + `%' AND a.article_id < ` + strconv.Itoa(utils.SummaryArticleId) + `  AND publish_status = 1 ) `
 	condition = ` AND m.industry_name LIKE '%` + keyWord + `%' AND a.article_id < ` + strconv.Itoa(utils.SummaryArticleId) + conditionOr
-
-	listHzResource, err := models.GetSearchResourceListHz(condition, 0, pageSize)
+	var pageSizeHzResource int
+	if searchType == 1 {
+		pageSizeHzResource = 5
+	} else {
+		pageSizeHzResource = 100
+	}
+	listHzResource, err := models.GetSearchResourceListHz(condition, 0, pageSizeHzResource)
 	if err != nil {
 		br.Msg = "获取信息失败"
 		br.ErrMsg = "获取品种信息失败,Err:" + err.Error()