From a7c6227fc4101aae648f8363e7a9a785fe9561e4 Mon Sep 17 00:00:00 2001
From: panlei <2799247126@qq.com>
Date: 星期四, 14 十一月 2019 15:09:09 +0800
Subject: [PATCH] 结果标签大改动

---
 insertdata/insertDataToEs.go |   36 ++++++++++++++++++------------------
 1 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/insertdata/insertDataToEs.go b/insertdata/insertDataToEs.go
index 77773db..7af0fa4 100644
--- a/insertdata/insertDataToEs.go
+++ b/insertdata/insertDataToEs.go
@@ -184,7 +184,7 @@
 
 // 寰�es涓彃鍏ヤ汉鑴告暟鎹�
 func InsertFace(msg structure.ResultMsg) {
-	if msg.RuleResult["face"] != nil && len(msg.RuleResult["face"].([]structure.TargetResult)) > 0 {
+	if msg.RuleResult["face"] != nil && len(msg.RuleResult["face"].([]structure.Result)) > 0 {
 		logger.Info("寰�ES鎻掍汉鑴告暟鎹�")
 		faces := []*FaceAndRules{}
 		faces = PutFace(faces, msg)
@@ -216,7 +216,7 @@
 				// 涓婁紶澶у浘
 				if imgMaxUrl == "" {
 					bigPhotoUrl := make(map[string]interface{})
-					bigPhotoUrl, err = util.DrawPolygonOnImageForFace(msg.Cid, i, msg.RuleResult["face"].([]structure.TargetResult), weedfsUrl)
+					bigPhotoUrl, err = util.DrawPolygonOnImageForFace(msg.Cid, i, msg.RuleResult["face"].([]structure.Result), weedfsUrl)
 					logger.Debug("========澶у浘璺緞锛�", bigPhotoUrl)
 					imgMaxUrl = bigPhotoUrl["fileUrl"].(string)
 					picTime = i.Timestamp
@@ -295,8 +295,8 @@
 
 // 褰掔疆浜鸿劯
 func PutFace(faces []*FaceAndRules, msg structure.ResultMsg) []*FaceAndRules {
-	if msg.RuleResult["face"] != nil && len(msg.RuleResult["face"].([]structure.TargetResult)) > 0 {
-		for _, faceResult := range msg.RuleResult["face"].([]structure.TargetResult) {
+	if msg.RuleResult["face"] != nil && len(msg.RuleResult["face"].([]structure.Result)) > 0 {
+		for _, faceResult := range msg.RuleResult["face"].([]structure.Result) {
 			faces = hebingFace(faces, faceResult)
 		}
 		return faces
@@ -304,8 +304,8 @@
 		return nil
 	}
 }
-func hebingFace(faces []*FaceAndRules, faceResult structure.TargetResult) []*FaceAndRules {
-	for _, arg := range faceResult.Args {
+func hebingFace(faces []*FaceAndRules, faceResult structure.Result) []*FaceAndRules {
+	for _, arg := range faceResult.AlarmObj {
 		// 鎷垮埌姣忎竴寮犱汉鑴�
 		//logger.Info("褰掔疆浜鸿劯鏃剁浉浼艰�呯殑鏁伴噺锛�", len(arg.Liker))
 		flag := false
@@ -315,7 +315,7 @@
 			//}
 			if arg.Id == face.Id {
 				flag = true
-				face.rules = append(face.rules, faceResult.Result)
+				face.rules = append(face.rules, faceResult)
 				// 鐩镐技鑰呭幓閲嶅綊骞�
 				for _, liker := range arg.Liker {
 					flag1 := true
@@ -332,7 +332,7 @@
 			}
 		}
 		if !flag {
-			faces = append(faces, &FaceAndRules{arg, []structure.Result{faceResult.Result}})
+			faces = append(faces, &FaceAndRules{*arg, []structure.Result{faceResult}})
 		}
 	}
 	return faces
@@ -391,20 +391,20 @@
 						}
 					}
 					// 瑁呴厤鐩爣淇℃伅鏁版嵁
-					for _, target := range yoloResult.Location {
+					for _, target := range yoloResult.AlarmObj {
 						// 鍘婚噸娣诲姞
 						var flag = true
 						for _, selectTarget := range targetInfos {
-							if strconv.FormatUint(target.TargetId, 10) == selectTarget.TargetId {
+							if strconv.FormatUint(target.Id, 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}}
+							target1.TargetId = strconv.FormatUint(target.Id, 10)
+							target1.TargetScore = target.Score
+							target1.TargetLocation = Points{TopLeft: Point{target.Location.X, target.Location.Y}, BottomRight: Point{target.Location.X + target.Location.Width, target.Location.Y + target.Location.Height}}
 							targetInfos = append(targetInfos, *target1)
 						}
 					}
@@ -639,20 +639,20 @@
 						}
 					}
 					// 瑁呴厤鐩爣淇℃伅鏁版嵁
-					for _, target := range yoloResult.Location {
+					for _, target := range yoloResult.AlarmObj {
 						// 鍘婚噸娣诲姞
 						var flag = true
 						for _, selectTarget := range targetInfos {
-							if strconv.FormatUint(target.TargetId, 10) == selectTarget.TargetId {
+							if strconv.FormatUint(target.Id, 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}}
+							target1.TargetId = strconv.FormatUint(target.Id, 10)
+							target1.TargetScore = target.Score
+							target1.TargetLocation = Points{TopLeft: Point{target.Location.X, target.Location.Y}, BottomRight: Point{target.Location.X + target.Location.Width, target.Location.Y + target.Location.Height}}
 							targetInfos = append(targetInfos, *target1)
 						}
 					}

--
Gitblit v1.8.0