From e3a7f12a6191a6b6bdeb08a2ce2052bf67449b1b Mon Sep 17 00:00:00 2001
From: liuxiaolong <736321739@qq.com>
Date: 星期五, 27 九月 2019 16:06:40 +0800
Subject: [PATCH] fix cameraadd
---
service/CameraVideoService.go | 22 +++++++++++++++-------
1 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/service/CameraVideoService.go b/service/CameraVideoService.go
index 74423c3..8a158f2 100644
--- a/service/CameraVideoService.go
+++ b/service/CameraVideoService.go
@@ -1,8 +1,11 @@
package service
import (
+ "basic.com/valib/logger.git"
"encoding/json"
"fmt"
+ "strconv"
+ "webserver/cache"
"webserver/extend/config"
"webserver/extend/esutil"
"webserver/models"
@@ -10,16 +13,23 @@
// 鍦板簱浜哄憳鏁版嵁 涓� 姣斿鍋氬噯澶�
func QueryDbPersonsForCompare(reqBody models.EsSearch) map[string]interface{} {
- url := "http://" + config.EsInfo.Masterip + ":" + config.EsInfo.Httpport +
+ localConf, err2 := cache.GetServerInfo()
+ if err2 !=nil || localConf.AlarmIp == "" || localConf.ServerId == "" {
+ logger.Debug("localConfig is wrong!!!")
+ return nil
+ }
+ url := "http://" + localConf.AlarmIp + ":" + strconv.Itoa(int(localConf.AlarmPort)) +
"/" + config.EsInfo.EsIndex.Dbtablepersons.IndexName + "/_search"
tableIds := make([]string, 20)
if reqBody.DataBases != nil {
tableIds = reqBody.DataBases
}
- startDate := "";endDate := ""
+ startDate := ""
+ endDate := ""
if reqBody.SearchTime != nil && len(reqBody.SearchTime) >= 2 {
dates := reqBody.SearchTime
- startDate = dates[0];endDate = dates[1] // 璧峰缁撴潫鏃堕棿
+ startDate = dates[0]
+ endDate = dates[1] // 璧峰缁撴潫鏃堕棿
}
contentValue := reqBody.InputValue //杈撳叆妗嗗唴瀹�
/*page := 1 ;if reqBody["page"] != nil { page = int(reqBody["page"].(float64)) } // 椤电爜
@@ -35,7 +45,7 @@
syncTerm += ",{\"terms\":{\"tableId\":" + string(bytes) + "}}" // 搴曞簱浜哄憳
}
if startDate != "" && endDate != "" {
- syncTerm += ",{\"range\":{\"create_time\":{\"from\":\"" + startDate + "\"," +
+ syncTerm += ",{\"range\":{\"createTime\":{\"from\":\"" + startDate + "\"," +
"\"to\":\"" + endDate + "\",\"include_lower\":true,\"include_upper\":true,\"boost\":1}}}" // 搴曞簱浜哄憳
}
if contentValue != "" {
@@ -43,10 +53,8 @@
"\"fields\":[\"personName\",\"sex\",\"idcard\",\"phoneNum\",\"reserved\"],\"boost\":1}}]"
}
params := "{\"query\":{\"bool\":{\"filter\":[" +
- "{\"term\":{\"del_flag\":\"0\"}}" + syncTerm + "]" + contentParam + "}},\"from\":0,\"size\":10000,\"sort\":{\"uuid\":{\"order\":\"desc\"}}}"
+ "{\"term\":{\"isDelete\":\"0\"}}" + syncTerm + "]" + contentParam + "}},\"from\":0,\"size\":10000,\"sort\":{\"uuid\":{\"order\":\"desc\"}}}"
fmt.Print("鏌ヨ鍏ㄩ儴搴曞簱浜哄憳 璇锋眰url:%s;\n 璇锋眰鍙傛暟params:%s", url, params)
data := esutil.GetEsDataReq(url, params, true)
return data
}
-
-
--
Gitblit v1.8.0