---
panlei
2019-11-06 993dc81c942d6b1315684cda034c8859a6f4d02b
ruleserver/timeTicker.go
@@ -2,7 +2,8 @@
import (
   "fmt"
   "ruleprocess/logger"
   "basic.com/valib/logger.git"
   "ruleprocess/structure"
   "strings"
   "time"
)
@@ -18,7 +19,7 @@
   InitN        int       // 赋值后就不变的初始值
   BufferFlag   int       // 缓冲容错位 连续n帧false才为false
   AlarmFlag    bool      // 报警标志位 定时器开启后第一次报警时会被置为true 往后再来报警也不会插进ES
   CacheSdkData ResultMsg // 定时器的缓存数据 持续时间类的开启定时器时要缓存一帧
   CacheSdkData structure.ResultMsg // 定时器的缓存数据 持续时间类的开启定时器时要缓存一帧
   GroupId      string    // 联动规则需要记录下此时的规则组id
   RuleResults  []*RuleResult
}
@@ -28,7 +29,7 @@
   Sort        int32     // 摄像机在规则组中序号
   Result      string    // 摄像机过滤数据得出的结果
   RuleWithPre string    // 摄像机之间的连接符
   CacheData   ResultMsg // 缓存当前帧数据
   CacheData   structure.ResultMsg // 缓存当前帧数据
}
func TimeTicker() {
@@ -69,7 +70,7 @@
}
// 判断是否符合定时器条件
func TimerAlarm(oth *Others, groupId string, result bool) (string) {
func TimerAlarm(oth *structure.Others, groupId string, result bool) (string) {
   var flagTime string //
   // 判断有无此规则组的定时器
   flag := false
@@ -93,7 +94,7 @@
                  logger.Debug("———————————-------------首次符合持续时间规则并报警")
                  flagTime = "10"
                  timeEle.AlarmFlag = true
                  oth.CacheData = []ResultMsg{}
                  oth.CacheData = []structure.ResultMsg{}
                  oth.CacheData = append(oth.CacheData,timeEle.CacheSdkData)
                  oth.TimeLabel = flagTime
               }
@@ -147,7 +148,7 @@
func (p SubList) Less(i, j int) bool { return p[i].Sort < p[j].Sort }
// 结构体根据某字段排序
type resultList []*LittleRuleResult
type resultList []*structure.LittleRuleResult
func (p resultList) Swap(i, j int)      { p[i], p[j] = p[j], p[i] }
func (p resultList) Len() int           { return len(p) }