|
@@ -708,12 +708,38 @@ class HaiKangController extends BaseController
|
|
|
$cover_picture = CameraList::where('id', Input::get('camera_id'))->value('cover_picture');
|
|
|
|
|
|
if (!$cover_picture) {
|
|
|
- register_shutdown_function(array($this, "getFirstPicture"),$path,$ffmpeg_rtmp);
|
|
|
+// register_shutdown_function(array($this, "getFirstPicture"),$path,$ffmpeg_rtmp);
|
|
|
+ $this->getPictureByHk($query);
|
|
|
}
|
|
|
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
+ //宁煤通过海康接口获取首桢图片
|
|
|
+ public function getPictureByHk($query){
|
|
|
+ $url = $this->artemis.'/apiideo1/manualCapture';
|
|
|
+ $params['cameraIndexCode'] = $query->index_code;
|
|
|
+ $this->sign = $this->get_sign($url);
|
|
|
+ $picture = $this->curlPost($this->pre_url . $url, json_encode($params));
|
|
|
+ $picture = json_decode($picture, true);
|
|
|
+ if($picture['data']['picUrl']){
|
|
|
+ if (!is_dir('/www/wwwrootideo.nxjiewei.com/public/' . CameraEnum::M3U8_FILE_PATH.'/img/' )) {
|
|
|
+ mkdir('/www/wwwrootideo.nxjiewei.com/public/' . CameraEnum::M3U8_FILE_PATH.'/img/', 0777, true);
|
|
|
+ }
|
|
|
+ $path = '/www/wwwrootideo.nxjiewei.com/public/' . CameraEnum::M3U8_FILE_PATH.'/img/';
|
|
|
+ $cms = new CameraServices();
|
|
|
+ $file_name = $cms->downloadFile($picture['data']['picUrl'],$path);
|
|
|
+ //判断图片是否存在
|
|
|
+ $picture_exists = file_exists($path . '/' . $file_name);
|
|
|
+ if ($picture_exists) {
|
|
|
+ //上传图片到oss并更新数据库
|
|
|
+ $picture_path = $cms->uploadOssFile($file_name, $path);
|
|
|
+ CameraList::where('id',$query->id)->update(['cover_picture' => $picture_path]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
//宁煤集团获取rtsp流后获取首帧图片
|
|
|
public function getFirstPicture($path,$ffmpeg_rtsp){
|
|
|
if (!is_dir('/www/wwwroot/video.nxjiewei.com/public/' . CameraEnum::M3U8_FILE_PATH . '/' . $path)) {
|