| | |
| | | "gat1400Exchange/models" |
| | | "gat1400Exchange/pkg" |
| | | "gat1400Exchange/pkg/logger" |
| | | "gat1400Exchange/service" |
| | | "gat1400Exchange/util" |
| | | "gat1400Exchange/vo" |
| | | ) |
| | |
| | | func (c CaptureRepository) PackPushDataV2(deviceId, faceId, appearTime string, bgImgBytes, faceImgBytes []byte) *vo.PushDataInfoV2 { |
| | | var pd = new(vo.PushDataInfoV2) |
| | | var floor string |
| | | var runDir string |
| | | |
| | | faceAppearTime, err := time.ParseInLocation("20060102150405", appearTime, time.Local) |
| | | if err != nil { |
| | |
| | | faceAppearTime = time.Now() |
| | | } |
| | | |
| | | if config.ServeConf.Role == "server" { |
| | | // 判断是否需要匹配楼层 |
| | | if config.NVCSConf.Model != "" { |
| | | // 匹配楼层 |
| | | var devPos models.Positions |
| | | _ = devPos.FindDevicePosition(deviceId, faceAppearTime.Unix()+5) // 加5秒电梯关门的时间 |
| | | |
| | | floor = devPos.Pos |
| | | stopFloorId := devPos.Id |
| | | |
| | | for i := 0; i < 30; i++ { |
| | | if err := devPos.FindMovePosition(stopFloorId, floor); err == nil { |
| | | switch devPos.RunDir { |
| | | case service.RunUp: |
| | | runDir = "in" |
| | | case service.RunDown: |
| | | runDir = "out" |
| | | case service.RunStop: |
| | | runDir = "" |
| | | } |
| | | |
| | | break |
| | | } |
| | | |
| | | time.Sleep(1 * time.Second) |
| | | } |
| | | } |
| | | |
| | | pd.PicMaxImages = append(pd.PicMaxImages, bgImgBytes) |
| | |
| | | pd.DataSource = "camera" |
| | | pd.CameraFloor = floor |
| | | pd.CameraId = deviceId |
| | | pd.Direction = runDir |
| | | |
| | | return pd |
| | | } |
| | |
| | | MsgId: msgId, |
| | | } |
| | | |
| | | logger.Debug("Pub record message %s, %s", deviceId,msgId) |
| | | logger.Debug("Pub record message %s, %s", deviceId, msgId) |
| | | body, _ := json.Marshal(&msg) |
| | | |
| | | _,err := util.HttpPost(config.ForwardConf.RecordServer, nil, body) |
| | | _, err := util.HttpPost(config.ForwardConf.RecordServer, nil, body) |
| | | if err != nil { |
| | | logger.Warn(err.Error()) |
| | | } |