| | |
| | | import ( |
| | | "context" |
| | | "encoding/json" |
| | | "gat1400Exchange/config" |
| | | "strings" |
| | | "sync" |
| | | "time" |
| | |
| | | } |
| | | } |
| | | |
| | | func InitSubscribeTask() error { |
| | | func InitSubscribeTask() { |
| | | var s models.Subscribe |
| | | subList, err := s.FindAll() |
| | | subList, err := s.FindByFromId(config.ClientConf.ServerId) |
| | | if err != nil { |
| | | logger.Error("Find account by channel error:%v", err) |
| | | return err |
| | | logger.Error("Find subscribe error, server id %s, %v", config.ClientConf.ServerId, err) |
| | | return |
| | | } |
| | | |
| | | for idx, _ := range subList { |
| | |
| | | CreateTask(&subList[idx]) |
| | | } |
| | | |
| | | return nil |
| | | return |
| | | } |
| | | |
| | | func AddFaceCapture(face *vo.FaceObject) { |
| | | func AddFaceNotification(face *vo.FaceObject) { |
| | | TaskProcMap.Range(func(key, value interface{}) bool { |
| | | value.(TaskProcInfo).task.AddFace(face) |
| | | return true |
| | | }) |
| | | |
| | | logger.Debug("添加人脸.") |
| | | //TaskWaitGroup.Wait() |
| | | logger.Debug("Add Face Notification.") |
| | | } |
| | | |
| | | func StopSubscribeTask() { |
| | |
| | | } |
| | | var ids []string |
| | | for idx, _ := range task.faceList { |
| | | // 按海康示例填充修改字段 |
| | | task.faceList[idx].ShotTime = task.faceList[idx].FaceAppearTime |
| | | task.faceList[idx].EntryTime = triggerTime |
| | | for i, _ := range task.faceList[idx].SubImageList.SubImageInfoObject { |
| | | task.faceList[idx].SubImageList.SubImageInfoObject[i].EventSort = 2 |
| | | } |
| | | |
| | | ids = append(ids, task.faceList[idx].FaceID) |
| | | notification.FaceObjectList.FaceObject = append(notification.FaceObjectList.FaceObject, *task.faceList[idx]) |
| | | } |