| | |
| | | |
| | | import ( |
| | | "basic.com/pubsub/protomsg.git" |
| | | logger "github.com/alecthomas/log4go" |
| | | "basic.com/valib/logger.git" |
| | | "github.com/knetic/govaluate" |
| | | "ruleprocess/ruleserver" |
| | | "ruleprocess/structure" |
| | |
| | | rw.Lock() |
| | | |
| | | if result { // 结果为真 |
| | | for k, tar := range structure.StaticMap[areaId].Targets { |
| | | for _, tar := range structure.StaticMap[areaId].Targets { |
| | | if tar.Id == person.Id { |
| | | if tar.N == 0 && tar.AlarmFlag { |
| | | logger.Debug("-------------------------符合持续时间规则但并不是首次,不报警") |
| | | //logger.Debug("-------------------------符合持续时间规则但并不是首次,不报警") |
| | | flagTime = "11" |
| | | o.TimeLable = flagTime |
| | | o.CacheData = tar.CacheSdkData |
| | |
| | | flagTime = "00" |
| | | // 有定时器但不为0把已打的标签删除 |
| | | // args.RuleResult = nil |
| | | logger.Debug("------------------------结果为真但计数器不到0,不报警,此时的计数器", k, "的值为:", tar.N) |
| | | //logger.Debug("------------------------结果为真但计数器不到0,不报警,此时的计数器", k, "的值为:", tar.N) |
| | | } |
| | | } |
| | | } |
| | |
| | | if tar.Id == person.Id { |
| | | if tar.AlarmFlag { |
| | | if tar.BufferFlag == 0 { |
| | | logger.Debug("------------------------------杀死计数器,报警此帧状态改变的数据,此时的计数器的值为", tar.N) |
| | | //logger.Debug("------------------------------杀死计数器,报警此帧状态改变的数据,此时的计数器的值为", tar.N) |
| | | flagTime = "12" |
| | | structure.StaticMap[areaId].Targets = append(structure.StaticMap[areaId].Targets[:index],structure.StaticMap[areaId].Targets[index+1:]...) |
| | | } else { |
| | |
| | | } |
| | | } |
| | | } else { |
| | | logger.Debug("-----------结果为假且不到0,杀死定时器") |
| | | //logger.Debug("-----------结果为假且不到0,杀死定时器") |
| | | structure.StaticMap[areaId].Targets = append(structure.StaticMap[areaId].Targets[:index],structure.StaticMap[areaId].Targets[index+1:]...) |
| | | } |
| | | } |