From a07cb9faca7bd4232a4230399eccb23d4b2acc0d Mon Sep 17 00:00:00 2001
From: liuxiaolong <736321739@qq.com>
Date: 星期一, 04 十一月 2019 16:03:46 +0800
Subject: [PATCH] fix get data

---
 esutil/EsClient.go |   26 ++++++++++++++------------
 1 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/esutil/EsClient.go b/esutil/EsClient.go
index 6bb4c56..509cbc3 100644
--- a/esutil/EsClient.go
+++ b/esutil/EsClient.go
@@ -12,7 +12,7 @@
 	"strings"
 	"sync"
 	"time"
-	"andriodServer/config"
+	"andriodServer/extend/config"
 
 	log "andriodServer/log"
 )
@@ -360,33 +360,35 @@
 	return value[i-1]
 }
 
-func PostAction(sec int, Eurl string, picurl string, ishub string, size int) []byte {
+func PostAction(sec int, Eurl string, picurl string, ishub string, size int, lastT time.Time, curTime time.Time) []byte {
+	//lastTimeStr := lastT.Format("2006-01-02 15:04:05")
+	//curTimeStr := curTime.Format("2006-01-02 15:04:05")
 	index := "videopersons,personaction"
 	url := fmt.Sprintf("%s%s%s", Eurl, index, "/_search")
 	startTime := time.Now()
-	seccond := strconv.Itoa(sec)
-	preSec := ""
-	if sec > 60 {
-		preSec = "-60s"
-	}
+
 	sizeStr :=""
 	if size <=0 {
-		sizeStr = "100"
+		sizeStr = "1000"
 	} else {
 		sizeStr = strconv.Itoa(size)
 	}
-
+	preSec := "10"
+	if sec <=0 {
+		preSec = "10"
+	}
 	var filterArr []string
 	if ishub == "hub" {
 		filterArr = append(filterArr,"{\"term\":{\"personIsHub\":\"1\"}}")
 	}
-	if sec > 60 {
-		filterArr = append(filterArr, "{\"range\":{\"picDate\":{\"gte\":\"now+8h-" + seccond + "s\",\"lt\":\"now+8h"+preSec+"\"}}}")
-	}
+
+	filterArr = append(filterArr, "{\"range\":{\"picDate\":{\"gte\":\"now+8h-"+preSec+"s\",\"lt\":\"now+8h\"}}}")
+
 	filterStr := ""
 	if len(filterArr) >0 {
 		filterStr = strings.Join(filterArr, ",")
 	}
+	log.Log.Infoln("filterArr:", filterStr)
 	prama := "{\"query\":{\"bool\":{\"filter\":["+filterStr+"]}},\"size\":\""+sizeStr+"\",\"sort\":[{\"picDate\":{\"order\":\"desc\"}}]," +
 		"\"_source\":[\"baseInfo\",\"Gender\",\"BaseName\",\"Age\",\"personId\",\"personPicUrl\",\"indeviceName\",\"imgKey\",\"sdkType\",\"ageDescription\",\"indeviceid\",\"content\",\"Id\",\"picAddress\",\"picMaxUrl\",\"picDate\",\"Race\",\"videoNum\",\"picSmUrl\",\"taskName\",\"personIsHub\",\"idcard\",\"videoIp\",\"videoReqNum\"]" +
 		"}"

--
Gitblit v1.8.0