From efbbfc3e0f6331a5f1edf51ae89d20a898badee6 Mon Sep 17 00:00:00 2001 From: Default Date: Thu, 3 Apr 2025 17:30:41 +0800 Subject: [PATCH] fix no chapter page error --- code/app/home/controller/Novel.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/code/app/home/controller/Novel.php b/code/app/home/controller/Novel.php index 6df204c..ad55d79 100644 --- a/code/app/home/controller/Novel.php +++ b/code/app/home/controller/Novel.php @@ -553,11 +553,16 @@ class Novel extends BaseController $arrChapter = $ChapterModel->getChapter($arrFilter); // 上一章节和下一章节 - $arrPreChapter = $ChapterModel->getPreChapter($arrChapter['n_id'], $arrChapter['c_sort_num'], $arrChapter['c_page']); - $arrNextChapter = $ChapterModel->getNextChapter($arrChapter['n_id'], $arrChapter['c_sort_num'], $arrChapter['c_page']); - + $arrPreChapter = $arrNextChapter = []; + + if ($arrChapter) { + $arrPreChapter = $ChapterModel->getPreChapter($arrChapter['n_id'], $arrChapter['c_sort_num'], $arrChapter['c_page']); + $arrNextChapter = $ChapterModel->getNextChapter($arrChapter['n_id'], $arrChapter['c_sort_num'], $arrChapter['c_page']); + } + + $arrCategoryAll = CategoryModel::$arrCategoryAll; - + View::assign([ 'arrNovel' => $arrNovel, 'arrCategoryAll' => $arrCategoryAll, @@ -613,7 +618,6 @@ class Novel extends BaseController $intButtomNum = 5; if ($boolIsMobile == false) { $intButtomNum = 10; - } $strBaseUrl = sprintf('/pc/xiaoshuo/%s-%s/mulu/%s/{page}', $arrNovel['og_novel_pin_yin'], $intNId, $strOrder);