app首页视频封面,上传监控视频封面
This commit is contained in:
parent
5e240474e0
commit
59cfacccf4
|
@ -5,6 +5,7 @@ use app\common\enum\notice\NoticeEnum;
|
||||||
use app\common\model\action\Action;
|
use app\common\model\action\Action;
|
||||||
use app\common\model\device\Device;
|
use app\common\model\device\Device;
|
||||||
use app\common\model\device\MonitorThreshold;
|
use app\common\model\device\MonitorThreshold;
|
||||||
|
use app\common\model\file\File;
|
||||||
use app\common\model\land\Land;
|
use app\common\model\land\Land;
|
||||||
use app\common\model\land\LandProduct;
|
use app\common\model\land\LandProduct;
|
||||||
use app\common\model\LandCollection;
|
use app\common\model\LandCollection;
|
||||||
|
@ -48,6 +49,9 @@ class IndexController extends BaseApiController
|
||||||
$device = Device::where('id', $productDevice['device_id'])->findOrEmpty();
|
$device = Device::where('id', $productDevice['device_id'])->findOrEmpty();
|
||||||
$data['video_url'] = $device['video_url'];
|
$data['video_url'] = $device['video_url'];
|
||||||
$data['device_id'] = $device['id'];
|
$data['device_id'] = $device['id'];
|
||||||
|
// 监控视频封面
|
||||||
|
$file = File::where('cid', $device['id'])->order('id', 'desc')->findOrEmpty();
|
||||||
|
$data['video_cover'] = isset($file['url'])? env('project.project_url').'/'.$file['url']: '';
|
||||||
$landCollection = LandCollection::where('land_id',$params['land_id'])->order('id desc')->findOrEmpty();
|
$landCollection = LandCollection::where('land_id',$params['land_id'])->order('id desc')->findOrEmpty();
|
||||||
if($landCollection->isEmpty()){
|
if($landCollection->isEmpty()){
|
||||||
$data['monitor'] = [];
|
$data['monitor'] = [];
|
||||||
|
|
|
@ -44,5 +44,16 @@ class UploadController extends BaseApiController
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function uploadVideoCover()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$deviceId = $this->request->param('device_id', '');
|
||||||
|
$result = UploadService::image($deviceId, $this->userId,FileEnum::SOURCE_USER);
|
||||||
|
return $this->success('上传成功', ['url'=>env('project.project_url').'/'.$result['url']]);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
return $this->fail($e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue