| | |
| | | |
| | | c.JSON(http.StatusOK, gin.H{"ResponseStatusObject": rspMsg}) |
| | | } |
| | | func (a CaptureController) VideoLabels(c *gin.Context) { |
| | | var req vo.RequestVideoLabelList |
| | | if err := c.BindJSON(&req); err != nil { |
| | | c.AbortWithStatus(http.StatusBadRequest) |
| | | return |
| | | } |
| | | |
| | | if len(req.VideoLabelListObject.VideoLabelObject) == 0 { |
| | | c.AbortWithStatus(http.StatusBadRequest) |
| | | return |
| | | } |
| | | |
| | | videoLabel := req.VideoLabelListObject.VideoLabelObject[0] |
| | | logger.Debug("Receive new message, Id:%s Ip:%s faceId:%s, LeftTopX:%d, appearTime:%s", c.RemoteIP(), videoLabel.VideoLabelID) |
| | | |
| | | // 转人脸消息 |
| | | var face vo.FaceObject |
| | | face.FaceID = videoLabel.VideoLabelID |
| | | face.InfoKind = 1 |
| | | face.SourceID = videoLabel.VideoImageID |
| | | face.SourceID = videoLabel.VideoImageID |
| | | face.LocationMarkTime = videoLabel.CreateTimeAbs |
| | | face.FaceAppearTime = videoLabel.BehaviorAnalysisObject.BehaviorBeginTime |
| | | face.FaceDisAppearTime = videoLabel.BehaviorAnalysisObject.BehaviorEndTime |
| | | |
| | | for idx, _ := range videoLabel.SubImageList.SubImageInfoObject { |
| | | videoLabel.SubImageList.SubImageInfoObject[idx].EventSort = 10 |
| | | } |
| | | |
| | | face.SubImageList.SubImageInfoObject = videoLabel.SubImageList.SubImageInfoObject |
| | | |
| | | // 如果开启了下级, 身份应该是消息代理, 不再转发到服务器 |
| | | if config.ClientConf.Enable && config.ServeConf.Role == "agent" { |
| | | //go a.Repository.VIIDMsgForward(&req) |
| | | } else if config.ServeConf.Role == "cascade" { |
| | | go service.AddFaceNotification(&face) |
| | | } |
| | | |
| | | if config.ForwardConf.SyncServer != "" { |
| | | go a.Repository.FaceForward([]vo.FaceObject{face}) |
| | | } |
| | | |
| | | // 设备保活 |
| | | service.KeepDeviceAlive(videoLabel.IVADeviceID) |
| | | |
| | | rspMsg := vo.ResponseStatus{ |
| | | RequestURL: c.FullPath(), |
| | | StatusCode: vo.StatusSuccess, |
| | | StatusString: vo.StatusString[vo.StatusSuccess], |
| | | Id: videoLabel.VideoLabelID, |
| | | LocalTime: time.Now().Format("20060102150405"), |
| | | } |
| | | |
| | | c.JSON(http.StatusOK, gin.H{"ResponseStatusObject": rspMsg}) |
| | | } |