app首页视频封面,上传监控视频封面

This commit is contained in:
chenbo 2024-01-08 11:25:35 +08:00
parent 5e240474e0
commit 59cfacccf4
2 changed files with 15 additions and 0 deletions

View File

@ -5,6 +5,7 @@ use app\common\enum\notice\NoticeEnum;
use app\common\model\action\Action;
use app\common\model\device\Device;
use app\common\model\device\MonitorThreshold;
use app\common\model\file\File;
use app\common\model\land\Land;
use app\common\model\land\LandProduct;
use app\common\model\LandCollection;
@ -48,6 +49,9 @@ class IndexController extends BaseApiController
$device = Device::where('id', $productDevice['device_id'])->findOrEmpty();
$data['video_url'] = $device['video_url'];
$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();
if($landCollection->isEmpty()){
$data['monitor'] = [];

View File

@ -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());
}
}
}