---
panlei
2019-08-01 25559a9c7f590cb18a3ab18dd9734d6a3d219a48
ruleserver/timeTicker.go
@@ -28,7 +28,7 @@
   Sort        int32     // 摄像机在规则组中序号
   Result      string    // 摄像机过滤数据得出的结果
   RuleWithPre string    // 摄像机之间的连接符
   CacheData   *ResultMsg // 缓存当前帧数据
   CacheData   ResultMsg // 缓存当前帧数据
}
func TimeTicker() {
@@ -69,7 +69,7 @@
}
// 判断是否符合定时器条件
func TimerAlarm(args *SdkDatas, groupId string, result bool) (string) {
func TimerAlarm(oth *Others, groupId string, result bool) (string) {
   var flagTime string //
   // 判断有无此规则组的定时器
   flag := false
@@ -82,19 +82,19 @@
   if flag { // 有定时器
      if result { // 结果为真
         for k, timeEle := range TimeEleList {
            if strings.Contains(k, groupId) {
            if strings.Contains(k, groupId) && k != groupId{
               if timeEle.N == 0 && timeEle.AlarmFlag {
                  logger.Debug("-------------------------符合持续时间规则但并不是首次,不报警")
                  flagTime = "11"
                  args.RuleResult["timeLabel"] = flagTime
                  oth.TimeLabel = flagTime
               }
               if timeEle.N == 0 && !timeEle.AlarmFlag { // 这组规则的定时器要全部等于0   暂且认为一组规则只有一个定时器
                  logger.Debug("———————————-------------首次符合持续时间规则并报警")
                  flagTime = "10"
                  timeEle.AlarmFlag = true
                  args.RuleResult["cacheData"] = []ResultMsg{}
                  args.RuleResult["cacheData"] = append(args.RuleResult["cacheData"].([]ResultMsg),timeEle.CacheSdkData)
                  args.RuleResult["timeLabel"] = flagTime
                  oth.CacheData = []ResultMsg{}
                  oth.CacheData = append(oth.CacheData,timeEle.CacheSdkData)
                  oth.TimeLabel = flagTime
               }
               if timeEle.N != 0 {
                  flagTime = "00"
@@ -111,7 +111,7 @@
                  if timeEle.BufferFlag == 0 {
                     logger.Debug("------------------------------杀死定时器,报警此帧状态改变的数据,此时的计数器的值为", timeEle.N)
                     flagTime = "12"
                     args.RuleResult["timeLabel"] = flagTime
                     oth.TimeLabel = flagTime
                     delete(TimeEleList, k)
                  } else {
                     if timeEle.BufferFlag > 0 {
@@ -127,7 +127,7 @@
   } else { // 无定时器
      if result {
         flagTime = "01"
         args.RuleResult["timeLabel"] = flagTime
         oth.TimeLabel = flagTime
      } else {
         flagTime = "00"
      }