xiexiaoyuan 3 سال پیش
والد
کامیت
195680e051
2فایلهای تغییر یافته به همراه9 افزوده شده و 7 حذف شده
  1. 1 1
      services/activity/activity.go
  2. 8 6
      services/elastic/report.go

+ 1 - 1
services/activity/activity.go

@@ -283,7 +283,7 @@ func GetPurchaseDetail(permissionIds []int, userId uint64,  pageIndex, pageSize
 		temp.Content = fmt.Sprintf("活动时间:%s", timeStr)
 		temp.Time = item.ModifyTime
 		temp.TopName = item.ActivityName
-		temp.ImgUrl = utils.ALIYUN_YBIMG_HOST + "purchase_bg_activity"
+		temp.ImgUrl = utils.ALIYUN_YBIMG_HOST + "purchase_bg_activity.png"
 		list = append(list, temp)
 	}
 	ret.List = list

+ 8 - 6
services/elastic/report.go

@@ -92,10 +92,17 @@ func SearchReport(keyWord string, classifyIdFirsts []int, classifyIdSeconds []in
 			},
 		},
 	}
+	filterMustNot := []map[string]interface{}{
+		map[string]interface{}{
+			"exists": map[string]interface{}{
+				"field": "BodyContent",                     //过滤没有内容的报告(晨报和周报)bodyContent 不能为空
+			},
+		},
+	}
 	filterMap := map[string]interface{}{
 		"bool": map[string]interface{}{
 			"must": filterMust,
-			//"must_not": filterMustNot,
+			"must_not": filterMustNot,
 		},
 	}
 	source := map[string]interface{}{
@@ -131,13 +138,8 @@ func SearchReport(keyWord string, classifyIdFirsts []int, classifyIdSeconds []in
 		},
 	}
 	fmt.Println(source)
-	/*highlight := elastic.NewHighlight()
-	highlight = highlight.Fields(elastic.NewHighlighterField("content"), elastic.NewHighlighterField("title"))
-	highlight = highlight.PreTags("<font color='red'>").PostTags("</font>")*/
 	request := global.EsClient.Search(indexName).Source(source) // sets the JSON request
 
-//	searchMap := make(map[string]string)
-
 	searchResp, err = request.Do(context.Background())
 	if err != nil {
 		fmt.Print("结果err:")