|
@@ -1830,6 +1830,44 @@ class CameraServices
|
|
return $result;
|
|
return $result;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ //大华切片逻辑
|
|
|
|
+ public static function dahuafiles($parent_id, $camera_id){
|
|
|
|
+ $result['status'] = true;
|
|
|
|
+ $result['msg'] = ApiEnum::RETURN_SUCCESS;
|
|
|
|
+
|
|
|
|
+ $camera = CameraList::find($camera_id);
|
|
|
|
+
|
|
|
|
+ $degree = MineList::where('id', $camera->mine_id)->value('degree');
|
|
|
|
+ $degree = explode('|', $degree);
|
|
|
|
+
|
|
|
|
+ $path = '';
|
|
|
|
+ foreach ($degree as $key => $val) {
|
|
|
|
+ $path .= MineList::where('id', $val)->value('title') . '/';
|
|
|
|
+ }
|
|
|
|
+ $path .= $camera->camera_name . '/' . date('Ymd');
|
|
|
|
+
|
|
|
|
+ //标记摄像头为在线状态
|
|
|
|
+ CameraList::where('id', $camera_id)->update(['camera_status' => CameraEnum::CAMERA_STATUS_ONLINE]);
|
|
|
|
+
|
|
|
|
+ //如果m3u8文件已拉取,直接返回播放链接
|
|
|
|
+ if ($camera->revert_id == CameraEnum::CAMERA_FILE_EXIST) {
|
|
|
|
+ $result['data'] = [
|
|
|
|
+ 'camera_id' => $camera_id,
|
|
|
|
+ 'url' => env('VIDEO_SYSTEM_URL') . CameraEnum::M3U8_FILE_PATH . '/' . $path . '/' . CameraEnum::M3U8_FILE_NAME . '?' . time(),
|
|
|
|
+ ];
|
|
|
|
+ return $result;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $tdwy = new TdwyController();
|
|
|
|
+ $tdwy->dahuaRtsp($camera_id,$parent_id);
|
|
|
|
+ $result = $tdwy->dahuaRtsp($camera_id,$parent_id);
|
|
|
|
+
|
|
|
|
+ $res = self::getVideoStream($result['data']['url'], $path, $camera_id);
|
|
|
|
+ $result['data'] = $res['data'];
|
|
|
|
+ return $result;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
//通过rtmp同步m3u8文件并返回url
|
|
//通过rtmp同步m3u8文件并返回url
|
|
public static function downloadCameraFiles($parent_id, $camera_id)
|
|
public static function downloadCameraFiles($parent_id, $camera_id)
|
|
{
|
|
{
|