| | |
| | | } |
| | | |
| | | func Init() { |
| | | //logger.Debug("本机信息和server信息:", localConfig, serverIp, serverPort) |
| | | //bigCache.Init(dbTablePersons, serverIp, serverPort, localConfig.ServerId) |
| | | go Push1() |
| | | } |
| | | |
| | |
| | | taskGroup = task |
| | | } |
| | | } |
| | | //logger.Debug("当前数据帧要匹配的规则组:-------------------------","摄像机id:",cameraId,"任务id",taskId) |
| | | if taskGroup == nil { |
| | | return nil |
| | | } else { |
| | |
| | | return value2 |
| | | } |
| | | // 取出某个时间规则的第几天的规则段集合 |
| | | func GetTimeById(id string, index int) []TimeRange { |
| | | func GetTimeById(id string, index int) []structure.TimeRange { |
| | | _, cameraTimeRule := cache.GetTimeRuleById(id) |
| | | var timeRangeList []day |
| | | var timeRangeList []structure.Day |
| | | err := json.Unmarshal([]byte(cameraTimeRule.TimeRule), &timeRangeList) |
| | | if err != nil { |
| | | logger.Error("取时间规则时反序列化错误!") |
| | |
| | | return 0 |
| | | } |
| | | |
| | | type TimeRange struct { |
| | | Start string `json:"start"` |
| | | End string `json:"end"` |
| | | } |
| | | type day struct { |
| | | Day int `json:"day"` // 标示当前星期几 |
| | | TimeRange []TimeRange `json:"time_range"` // 当天的几个时间段 |
| | | } |
| | | |
| | | |
| | | // 将字符串格式的坐标序列化为Point格式 |
| | | func Json2points(areaPoints string) []Point { |
| | | var pts []Point |
| | | func Json2points(areaPoints string) []structure.Point { |
| | | var pts []structure.Point |
| | | if areaPoints == "[]" || areaPoints == "" { |
| | | logger.Error("=====================此区域为全部区域") |
| | | pts = append(pts, Point{0, 0}) |
| | | pts = append(pts, Point{0, 540}) |
| | | pts = append(pts, Point{960, 540}) |
| | | pts = append(pts, Point{960, 0}) |
| | | pts = append(pts, structure.Point{0, 0}) |
| | | pts = append(pts, structure.Point{0, 540}) |
| | | pts = append(pts, structure.Point{960, 540}) |
| | | pts = append(pts, structure.Point{960, 0}) |
| | | } else { |
| | | err := json.Unmarshal([]byte(areaPoints), &pts) |
| | | if err != nil { |
| | |
| | | } |
| | | |
| | | bytes := getCompareMsg(comArg) |
| | | //bytes := []byte{} |
| | | var scResult protomsg.SdkCompareResult |
| | | err1 := proto.Unmarshal(bytes, &scResult) |
| | | if err1 != nil { |
| | |
| | | } |
| | | } |
| | | logger.Info("区域是:",areaPoints,"区域内目标数量为:",a.TargetNum,"---",len(a.FilterData)) |
| | | //for _,tar := range a.FilterData { |
| | | // logger.Info("具体目标的坐标为",tar.Id,tar.Location) |
| | | //} |
| | | a.Time = time.Unix(time.Now().Unix(), 0).String()[11:16] |
| | | a.KeepRight = arg.KeepRight |
| | | a.IsStatic = arg.IsStatic |
| | |
| | | logger.Debug("数据推送成功!收到响应,数据长度为:",len(msg)) |
| | | return msg |
| | | } |
| | | |
| | | |
| | | func Push1(){ |
| | | //var sock mangos.Socket |