diff --git a/code/app/services/VideoService.php b/code/app/services/VideoService.php index c600441..a7b9d3b 100644 --- a/code/app/services/VideoService.php +++ b/code/app/services/VideoService.php @@ -10,6 +10,7 @@ use app\model\VideoCategoryModel; use app\model\VideoClicksModel; use app\model\VideoModel; use template\page\CusteomPage02; +use think\exception\HttpException; class VideoService { @@ -682,6 +683,10 @@ class VideoService // 视频详情 $arrVideo = $this->VideoModel->getVideoByVId($intVId); + if (empty($arrVideo)) { + throw new HttpException(404, '视频不存在'); + } + // 取前5个元素 $strTopActor = (is_array($arrVideo['v_actor'] ?? null)) ? array_slice($arrVideo['v_actor'], 0, 5) : '';