| | |
| | | |
| | | face := req.FaceListObject.FaceObject[0] |
| | | |
| | | logger.Debug("接收到人脸数据, faceId:%s, LeftTopX:%d", face.FaceID, face.LeftTopX) |
| | | logger.Debug("接收到人脸数据, ip:%s dev:%s faceId:%s, LeftTopX:%d", c.RemoteIP(), face.DeviceID, face.FaceID, face.LeftTopX) |
| | | |
| | | a.Repository.FaceForward(req.FaceListObject.FaceObject) |
| | | |
| | |
| | | |
| | | func (d *Device) Upsert() error { |
| | | var existingDevice Device |
| | | if err := db.Where("id = ?", d.Id).First(&existingDevice).Error; err != nil { |
| | | if err := db.Table(d.TableName()).Where("id = ?", d.Id).First(&existingDevice).Error; err != nil { |
| | | if err == gorm.ErrRecordNotFound { |
| | | // 记录不存在,创建新记录 |
| | | db.Create(&d) |
| | |
| | | var device models.Device |
| | | |
| | | if err := device.FindById(deviceId); err != nil { |
| | | logger.Debug("Can't find device in database, device:%s, %s", deviceId, err.Error()) |
| | | logger.Warn("Can't find device in database, device:%s, %s", deviceId, err.Error()) |
| | | return pd |
| | | } |
| | | |
| | |
| | | pd.PicMaxImages = append(pd.PicMaxImages, imageBytes) |
| | | |
| | | tr := vo.TaskResultInfo{ |
| | | Id: uuid.NewV4().String(), |
| | | CameraId: deviceId, |
| | | OrgName: "", |
| | | CameraAddr: device.Addr + device.Pos, |
| | | CameraName: device.Name, |
| | | PicMaxUrl: []string{""}, |
| | | PicDate: time.Now().Format("2006-01-02 15:04:05"), |
| | | LikeDate: time.Now().Format("2006-01-02 15:04:05"), |
| | | TaskId: "", |
| | | AnalyServerId: deviceId, |
| | | AnalyServerName: "", |
| | | AnalyServerIp: "", |
| | | DataSource: "camera", |
| | | TargetInfo: []vo.TargetInfo{{TargetId: faceId}}, |
| | | Id: uuid.NewV4().String(), |
| | | CameraId: deviceId, |
| | | CameraAddr: device.Addr + device.Pos, |
| | | CameraName: device.Name, |
| | | PicMaxUrl: []string{""}, |
| | | PicDate: time.Now().Format("2006-01-02 15:04:05"), |
| | | LikeDate: time.Now().Format("2006-01-02 15:04:05"), |
| | | AnalyServerId: deviceId, |
| | | DataSource: "camera", |
| | | TargetInfo: []vo.TargetInfo{{TargetId: faceId}}, |
| | | } |
| | | |
| | | pd.SourceData = vo.ESInfo{ |
| | |
| | | } |
| | | defer conn.Close() |
| | | |
| | | logger.Debug("UDP server listening on port %s...", port) |
| | | logger.Info("UDP server listening on port %s...", port) |
| | | |
| | | // 无限循环等待接收数据 |
| | | for { |
| | |
| | | return err |
| | | } |
| | | |
| | | logger.Info("Report device info. %+v", dev) |
| | | |
| | | _, err = HttpPost(config.ForwardConf.ReportServer, nil, data) |
| | | if err != nil { |
| | | return err |
| | | } |
| | | } |
| | | |
| | | return nil |
| | |
| | | for { |
| | | select { |
| | | case <-ticker.C: |
| | | logger.Debug("report device info.") |
| | | |
| | | err := reportDeviceInfo() |
| | | if err != nil { |
| | | logger.Warn(err.Error()) |
| | |
| | | } |
| | | |
| | | type TaskResultInfo struct { |
| | | Id string `json:"id"` |
| | | CameraId string `json:"cameraId"` |
| | | OrgName string `json:"orgName"` //机构名称 |
| | | CameraAddr string `json:"cameraAddr"` //小区名称 |
| | | CameraName string `json:"cameraName"` //具体位置 |
| | | PicDate string `json:"picDate"` |
| | | LikeDate string `json:"likeDate"` |
| | | PicMaxUrl []string `json:"picMaxUrl"` |
| | | TaskId string `json:"taskId"` |
| | | AnalyServerId string `json:"analyServerId"` |
| | | AnalyServerName string `json:"analyServerName"` |
| | | AnalyServerIp string `json:"analyServerIp"` |
| | | TargetInfo []TargetInfo `json:"targetInfo"` |
| | | DataSource string `json:"dataSource"` // 数据来源:摄像机, 数据栈 |
| | | Id string `json:"id"` |
| | | CameraId string `json:"cameraId"` |
| | | CameraAddr string `json:"cameraAddr"` //小区名称 |
| | | CameraName string `json:"cameraName"` //具体位置 |
| | | PicDate string `json:"picDate"` |
| | | LikeDate string `json:"likeDate"` |
| | | PicMaxUrl []string `json:"picMaxUrl"` |
| | | AnalyServerId string `json:"analyServerId"` |
| | | TargetInfo []TargetInfo `json:"targetInfo"` |
| | | DataSource string `json:"dataSource"` // 数据来源:摄像机, 数据栈 |
| | | } |
| | | |
| | | // es视频分析的数据结构 |