panlei
2019-11-30 cb75856a9440cf7a207e5c8cf05006d49b6d3f15
insertdata/insertDataToEs.go
@@ -1,7 +1,7 @@
package insertdata
import (
   "basic.com/valib/logger.git"
   logger "github.com/alecthomas/log4go"
   "encoding/base64"
   "encoding/json"
   "errors"
@@ -154,6 +154,7 @@
            faces = PutFace(faces, results.([]structure.Result))
            //logger.Info("整理后的数据:",faces)
            if faces != nil {
               logger.Warn("face不为nil")
               var imgMaxUrl []string = []string{}
               var picTime string = ""
               for _, face := range faces {
@@ -164,6 +165,7 @@
                     panic("解压缩图片时出现错误")
                  }
                  alarmRules := []AlarmRule{}
                  logger.Info("循环每一个目标")
                  for _, faceResult := range face.rules {
                     alarm := ChangeToString(faceResult.DefenceState, faceResult.AlarmLevel)
                     alarmRules = append(alarmRules, AlarmRule{faceResult.RuleGroupId, alarm, faceResult.RuleText, faceResult.DefenceState, ""})
@@ -171,7 +173,7 @@
                  i := protomsg.Image{}
                  err = proto.Unmarshal(bdata, &i)
                  // 先传小图,再传大图,防止脸上有线
                  bytes := util.SubImg(i, int(face.Location.X), int(face.Location.Y), int(face.Location.X+face.Location.Width), int(face.Location.Y+face.Location.Height))
                  bytes := util.SubImg(i, int(face.Location.X), int(face.Location.Y), int(face.Location.X+face.Location.Width), int(face.Location.Y+face.Location.Height),face.Type)
                  resp, err := util.PostFormBufferData1(weedfsUrl, bytes, uuid.NewV4().String())
                  if err != nil {
                     logger.Error("上传小图出错")
@@ -361,7 +363,7 @@
                     var target1 = new(Target)
                     target1.TargetId = target.Id
                     target1.TargetScore = target.Score
                     target1.TargetType = target.Type
                     target1.TargetType = "action"
                     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)
                  }
@@ -562,7 +564,7 @@
                  var target1 = new(Target)
                  target1.TargetId = target.Id
                  target1.TargetScore = target.Score
                  target1.TargetType = target.Type
                  target1.TargetType = "action"
                  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)
               }