From 9fc8aaf3af0a179dbb2e614496d39c922661de4a Mon Sep 17 00:00:00 2001 From: panlei <2799247126@qq.com> Date: 星期三, 23 十月 2019 17:57:54 +0800 Subject: [PATCH] 改造日志的输出方式 --- insertdata/insertDataToEs.go | 26 ++++++++++++++++++++++++-- 1 files changed, 24 insertions(+), 2 deletions(-) diff --git a/insertdata/insertDataToEs.go b/insertdata/insertDataToEs.go index 78400c8..f5804c4 100644 --- a/insertdata/insertDataToEs.go +++ b/insertdata/insertDataToEs.go @@ -1,7 +1,7 @@ package insertdata import ( - "basic.com/valib/logger.git" + "ruleprocess/logger" "encoding/base64" "encoding/json" "errors" @@ -109,6 +109,7 @@ IsAckAlarm int `json:"isAckAlarm"` IsCollect int `json:"isCollect"` IsDelete int `json:"isDelete"` + TargetInfo []Target } type AlarmRule struct { @@ -250,7 +251,6 @@ target.TargetScore = face.Score target.TargetLocation = Points{TopLeft:Point{face.Location.X,face.Location.Y},BottomRight:Point{face.Location.X+face.Location.Width,face.Location.Y+face.Location.Height}} //logger.Info("浜鸿劯鐨刬d:",strconv.FormatUint(face.Id, 10)) - //logger.Info("浜鸿劯鐨勫垎鍊硷細",face.Score) pervideo := PerVideoPicture{ esDataId, msg.Cid, @@ -364,6 +364,7 @@ logger.Info("寰�ES鎻抷olo鏁版嵁") var sdkNames string = "" alarmRules := []AlarmRule{} + var targetInfos []Target url := []string{} for _, yoloResult := range msg.RuleResult["yolo"].([]structure.Result) { if yoloResult.Others.TimeLabel == "01" || yoloResult.Others.TimeLabel == "10" { @@ -398,6 +399,25 @@ if resp1["fileUrl"] != nil { url = append(url, resp1["fileUrl"].(string)) } + } + } + // 瑁呴厤鐩爣淇℃伅鏁版嵁 + for _,target := range yoloResult.Location { + // 鍘婚噸娣诲姞 + logger.Info("瑁呴厤鍓嶇殑鍘熷鏁版嵁鏄細",target) + var flag = true + for _,selectTarget := range targetInfos { + if strconv.FormatUint(target.TargetId, 10) == selectTarget.TargetId { + flag = false + break + } + } + if flag { + var target1 = new(Target) + target1.TargetId = strconv.FormatUint(target.TargetId, 10) + target1.TargetScore = target.TargetScore + target1.TargetLocation = Points{TopLeft:Point{target.X,target.Y},BottomRight:Point{target.X+target.Width,target.Y+target.Height}} + targetInfos = append(targetInfos,*target1) } } } @@ -455,6 +475,7 @@ if err != nil { logger.Error("鏌ヨ鎽勫儚鏈轰俊鎭け璐�") } + serverIp, err := GetLocalIP() if resp["fileUrl"] != nil { url = append(url, resp["fileUrl"].(string)) @@ -485,6 +506,7 @@ 0, 0, 0, + targetInfos, } requstbody, err := json.Marshal(peraction) -- Gitblit v1.8.0