From 51899d8c81471f04ce223df926771c33964eafce Mon Sep 17 00:00:00 2001 From: koogua Date: Tue, 30 Mar 2021 20:07:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3file=5Ftranscode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/ChapterVod.php | 12 ++++++------ app/Services/ChapterVod.php | 4 +--- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/app/Models/ChapterVod.php b/app/Models/ChapterVod.php index 53166d64..be1b0335 100644 --- a/app/Models/ChapterVod.php +++ b/app/Models/ChapterVod.php @@ -81,12 +81,12 @@ class ChapterVod extends Model public function afterFetch() { - if (!empty($this->file_id)) { - if (is_string($this->file_transcode) && !empty($this->file_transcode)) { - $this->file_transcode = json_decode($this->file_transcode, true); - } else { - $this->file_transcode = $this->getFileTranscode($this->file_id); - } + if (is_string($this->file_transcode)) { + $this->file_transcode = json_decode($this->file_transcode, true); + } + + if (!empty($this->file_id) && empty($this->file_transcode)) { + $this->file_transcode = $this->getFileTranscode($this->file_id); } } diff --git a/app/Services/ChapterVod.php b/app/Services/ChapterVod.php index 4d070c95..a372b9c9 100644 --- a/app/Services/ChapterVod.php +++ b/app/Services/ChapterVod.php @@ -14,9 +14,7 @@ class ChapterVod extends Service $vod = $chapterRepo->findChapterVod($chapterId); - if (empty($vod->file_transcode)) { - return []; - } + if (empty($vod->file_transcode)) return []; $vodService = new VodService();