From 5fe4f1404735f2f7abfbba8a5a770bc2ff052c61 Mon Sep 17 00:00:00 2001
From: panlei <2799247126@qq.com>
Date: 星期五, 27 九月 2019 14:21:09 +0800
Subject: [PATCH] logger改用公共库

---
 insertdata/insertDataToEs.go |   28 ++++++++++++++++++++--------
 1 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/insertdata/insertDataToEs.go b/insertdata/insertDataToEs.go
index 3e3a447..8f87b0b 100644
--- a/insertdata/insertDataToEs.go
+++ b/insertdata/insertDataToEs.go
@@ -7,7 +7,7 @@
 	"fmt"
 	"net"
 	"ruleprocess/cache"
-	"ruleprocess/logger"
+	"basic.com/valib/logger.git"
 	"strconv"
 	"time"
 
@@ -29,11 +29,11 @@
 	DbTablePersons string `yaml:"dbTablePersons"`
 }
 
-func InitInsertEs() {
-	weedfsUrl = "http://"+WeedFs.Ip+":"+strconv.Itoa(WeedFs.UploadPort)+"/submit"
-	videoPersonUrl = "http://"+EsInfo.Masterip+":"+EsInfo.Httpport+"/"+EsInfo.EsIndex.VideoPersons.IndexName+"/"+EsInfo.EsIndex.VideoPersons.IndexType
-	personAction = "http://"+EsInfo.Masterip+":"+EsInfo.Httpport+"/"+EsInfo.EsIndex.Personaction.IndexName+"/"+EsInfo.EsIndex.Personaction.IndexType
-}
+//func InitInsertEs() {
+//	weedfsUrl = "http://"+WeedFs.Ip+":"+strconv.Itoa(WeedFs.UploadPort)+"/submit"
+//	videoPersonUrl = "http://"+EsInfo.Masterip+":"+EsInfo.Httpport+"/"+EsInfo.EsIndex.VideoPersons.IndexName+"/"+EsInfo.EsIndex.VideoPersons.IndexType
+//	personAction = "http://"+EsInfo.Masterip+":"+EsInfo.Httpport+"/"+EsInfo.EsIndex.Personaction.IndexName+"/"+EsInfo.EsIndex.Personaction.IndexType
+//}
 
 // 浜鸿劯鐨勬暟鎹粨鏋�
 type PerVideoPicture struct {
@@ -135,6 +135,18 @@
 //	//}
 //}
 func InsertToEs(msg ruleserver.ResultMsg) {
+	defer func() {
+		if err := recover(); err != nil {
+			logger.Error("es妯″潡鍎跨殑寮傚父鎹曡幏锛�",err)
+		}
+	}()
+	localConfig1, err := cache.GetServerInfo()
+	if err != nil {
+		panic("閰嶇疆鏂囦欢涓嶅悎娉�")
+	}
+	weedfsUrl = "http://"+localConfig1.WebPicIp+":"+strconv.Itoa(int(localConfig1.WebPicPort))+"/submit"
+	videoPersonUrl = "http://"+localConfig1.AlarmIp+":"+strconv.Itoa(int(localConfig1.AlarmPort))+"/"+EsInfo.EsIndex.VideoPersons.IndexName+"/"+EsInfo.EsIndex.VideoPersons.IndexType
+	personAction = "http://"+localConfig1.AlarmIp+":"+strconv.Itoa(int(localConfig1.AlarmPort))+"/"+EsInfo.EsIndex.Personaction.IndexName+"/"+EsInfo.EsIndex.Personaction.IndexType
 	InsertFace(msg, "")
 	// 濡傛灉鏍囩涓惈鏈夋寔缁椂闂撮娆℃姤璀︾殑timeLabel鐨勮瘽鍒欎笉闇�瑕佽繃浜轰綋杩借釜锛屼笉鐒跺氨娌$殑鎻掑叆浜�
 	fk := ruleserver.TrackOrNot(msg.RuleResult)
@@ -217,8 +229,8 @@
 				if linkId != "" {
 					linksId = linkId
 				}
-				logger.Info("浜鸿劯鐨刬d:",strconv.FormatUint(face.Id, 10))
-				logger.Info("浜鸿劯鐨勫垎鍊硷細",face.Score)
+				//logger.Info("浜鸿劯鐨刬d:",strconv.FormatUint(face.Id, 10))
+				//logger.Info("浜鸿劯鐨勫垎鍊硷細",face.Score)
 				pervideo := PerVideoPicture{
 					esDataId,
 					msg.Cid,

--
Gitblit v1.8.0