From 4eca70d6e153bdc566e429aef32d775d25e07ac1 Mon Sep 17 00:00:00 2001 From: make Date: Sat, 19 Apr 2025 11:56:30 +0800 Subject: [PATCH 1/2] debug --- code/app/home/config/router.php | 44 +++++++++---------- .../view/default/Novel/getNovelCatalog.html | 18 ++++---- .../home/view/default/Novel/getNovelInfo.html | 2 +- .../default/Pc/Public/allChapterPage.html | 12 ++--- .../home/view/default/Pc/getNovelCatalog.html | 17 +++---- .../home/view/default/Pc/getNovelChapter.html | 10 ++--- .../home/view/default/Pc/getNovelInfo.html | 4 +- .../view/default/Public/allChapterPage.html | 13 +++--- 8 files changed, 60 insertions(+), 60 deletions(-) diff --git a/code/app/home/config/router.php b/code/app/home/config/router.php index a283a79..b328d92 100644 --- a/code/app/home/config/router.php +++ b/code/app/home/config/router.php @@ -39,12 +39,12 @@ $arrRoutes = [ // 最新章节-特殊页面处理 'latest' => [ - '/xiaoshuo/:name-:n_id/chapter/latest', - '/novel/:name-:n_id/chapter/latest', - '/book/:name-:n_id/chapter/latest', - '/xiaoshuo-:name-:n_id/chapter/latest', - '/novel-:name-:n_id/chapter/latest', - '/book-:name-:n_id/chapter/latest', + '/xiaoshuo/:name-:intNovelId/chapter/latest', + '/novel/:name-:intNovelId/chapter/latest', + '/book/:name-:intNovelId/chapter/latest', + '/xiaoshuo-:name-:intNovelId/chapter/latest', + '/novel-:name-:intNovelId/chapter/latest', + '/book-:name-:intNovelId/chapter/latest', ], // 目录相关路径 @@ -59,22 +59,22 @@ $arrRoutes = [ // 伪小说详情相关路径 'kan-novel' => [ - '/kan-xiaoshuo/:name-:n_id-:n_forge_id', - '/show-novel/:name-:n_id-:n_forge_id', - '/seo-book/:name-:n_id-:n_forge_id', - '/show-xiaoshuo-:name-:n_id-:n_forge_id', - '/see-novel-:name-:n_id-:n_forge_id', - '/good-book-:name-:n_id-:n_forge_id', + '/kan-xiaoshuo/:name-:intNovelId-:n_forge_id', + '/show-novel/:name-:intNovelId-:n_forge_id', + '/seo-book/:name-:intNovelId-:n_forge_id', + '/show-xiaoshuo-:name-:intNovelId-:n_forge_id', + '/see-novel-:name-:intNovelId-:n_forge_id', + '/good-book-:name-:intNovelId-:n_forge_id', ], // 小说详情相关路径 'novel' => [ - '/xiaoshuo/:name-:n_id', - '/novel/:name-:n_id', - '/book/:name-:n_id', - '/xiaoshuo-:name-:n_id', - '/novel-:name-:n_id', - '/book-:name-:n_id', + '/xiaoshuo/:name-:intNovelId', + '/novel/:name-:intNovelId', + '/book/:name-:intNovelId', + '/xiaoshuo-:name-:intNovelId', + '/novel-:name-:intNovelId', + '/book-:name-:intNovelId', ], // 书库 @@ -168,7 +168,7 @@ foreach ($arrRoutes['prefixes'] as $platform => $prefixes) { //章节 Route::get($strRoute, [Novel::class, 'getNovelChapter']) - ->pattern(['intNovelId' => '\d+', 'name' => '[\w-]+', 'intChapterSort' => '\d+', 'intChapterPage' => '\d+']); + ->pattern(['n_id' => '\d+', 'name' => '[\w-]+', 'intChapterSort' => '\d+', 'intChapterPage' => '\d+']); break; case 'kan-novel': //伪造小说详情 @@ -197,7 +197,7 @@ foreach ($arrRoutes['prefixes'] as $platform => $prefixes) { Route::get($strRoute, function () use ($strView) { return view($strView); }) - ->pattern(['intNovelId' => '\d+', 'name' => '[\w-]+', 'strOrder' => 'zheng|dao', 'intPage' => '\d+']); + ->pattern(['n_id' => '\d+', 'name' => '[\w-]+', 'strOrder' => 'zheng|dao', 'intPage' => '\d+']); break; case 'library': @@ -224,12 +224,10 @@ foreach ($arrRoutes['prefixes'] as $platform => $prefixes) { if ($platform == 'h5') { $strView = 'novel/getLibrary.html'; } - //书库/分类 Route::get($strRoute, function () use ($strView) { return view($strView); }); - // //书库/分类首页 - // Route::get($strRoute, [Novel::class, 'getLibrary']); + break; case 'rank': //排行榜 diff --git a/code/app/home/view/default/Novel/getNovelCatalog.html b/code/app/home/view/default/Novel/getNovelCatalog.html index 1c5a747..495dea4 100644 --- a/code/app/home/view/default/Novel/getNovelCatalog.html +++ b/code/app/home/view/default/Novel/getNovelCatalog.html @@ -3,7 +3,7 @@ {block name="keywords"}{site:replace code="NOVEL@GETNOVELCATALOG@KEYWORDS"}{/block} {block name="description"}{site:replace code="NOVEL@GETNOVELCATALOG@DESCRIPTION"}{/block} {block name="head"} -{novel:info n_id="$Request.route.n_id" n_key="arrNovel" n_forge_id="0" /} +{novel:info n_id="$Request.route.intNovelId" n_key="arrNovel" n_forge_id="0" /} {site:grm page_code="pc_novel_info" diff="$arrNovel.n_id" num="100" g_key="arrGrm" /} @@ -163,12 +163,12 @@ {$arrNovel.n_description} -

章节列表(第{$intPage}页) - {if $strOrder == 'zheng'} - 章节列表(第{$Request.route.intPage}页) + {if $Request.route.strOrder == 'zheng'} + 点击切换倒序 {else} - 点击切换正序 {/if}

@@ -178,14 +178,14 @@ {include file="public/allChapterPage" start="1"/} {include file="public/allChapterPage" /} diff --git a/code/app/home/view/default/Novel/getNovelInfo.html b/code/app/home/view/default/Novel/getNovelInfo.html index bd0d816..81f17c0 100644 --- a/code/app/home/view/default/Novel/getNovelInfo.html +++ b/code/app/home/view/default/Novel/getNovelInfo.html @@ -3,7 +3,7 @@ $Novel.n_id{extend name="baseH5" /} {block name="keywords"}{site:replace code="NOVEL@GETNOVELINFO@KEYWORDS"}{/block} {block name="description"}{site:replace code="NOVEL@GETNOVELINFO@DESCRIPTION"}{/block} {block name="head"} -{novel:info n_id="$Request.route.n_id" n_key="arrNovel" n_forge_id="0" /} +{novel:info n_id="$Request.route.intNovelId" n_key="arrNovel" n_forge_id="0" /} {site:grm page_code="pc_novel_info" diff="$arrNovel.n_id" num="100" g_key="arrGrm" /} diff --git a/code/app/home/view/default/Pc/Public/allChapterPage.html b/code/app/home/view/default/Pc/Public/allChapterPage.html index caa0f29..d792c7c 100644 --- a/code/app/home/view/default/Pc/Public/allChapterPage.html +++ b/code/app/home/view/default/Pc/Public/allChapterPage.html @@ -1,6 +1,6 @@ -{if !empty($arrPaginator)} +{if !empty($page_data)}
- {volist name="arrPaginator" id="item"} + {volist name="page_data" id="item"} {eq name="item.type" value="prev"} @@ -10,10 +10,10 @@ {/volist} - {volist name="arrPaginator" id="item"} + {volist name="page_data" id="item"} {eq name="item.type" value="next"} diff --git a/code/app/home/view/default/Pc/getNovelCatalog.html b/code/app/home/view/default/Pc/getNovelCatalog.html index b38e476..7eee326 100644 --- a/code/app/home/view/default/Pc/getNovelCatalog.html +++ b/code/app/home/view/default/Pc/getNovelCatalog.html @@ -3,7 +3,7 @@ {block name="keywords"}{site:replace code="NOVEL@GETNOVELCATALOG@KEYWORDS"}{/block} {block name="description"}{site:replace code="NOVEL@GETNOVELCATALOG@DESCRIPTION"}{/block} {block name="head"} -{novel:info n_id="$Request.route.n_id" n_key="arrNovel" n_forge_id="0" /} +{novel:info n_id="$Request.route.intNovelId" n_key="arrNovel" n_forge_id="0" /} {site:grm page_code="pc_novel_info" diff="$arrNovel.n_id" num="100" g_key="arrGrm" /} @@ -145,12 +145,12 @@
-

《{$arrNovel.n_name}》章节列表(第{$intPage}页)切换倒序/正序: - {if $strOrder == 'zheng'} - 《{$arrNovel.n_name}》章节列表(第{$Request.route.intPage}页)切换倒序/正序: + {if $Request.route.strOrder == 'zheng'} + 点击切换倒序 {else} - 点击切换正序 {/if}

@@ -159,14 +159,15 @@ {include file="pc/public/allChapterPage" /} diff --git a/code/app/home/view/default/Pc/getNovelChapter.html b/code/app/home/view/default/Pc/getNovelChapter.html index c80303f..64bf1bf 100644 --- a/code/app/home/view/default/Pc/getNovelChapter.html +++ b/code/app/home/view/default/Pc/getNovelChapter.html @@ -85,7 +85,7 @@ {if $arrChapter && $arrChapter.c_sort_num && $arrChapter.c_sort_num == 1} 上一页 {else} - {$arrGRM[10]|raw} + {$arrGrm[10]|raw} 上一页 {/if} @@ -93,7 +93,7 @@ 章节目录 | {if $arrNextChapter && $arrNextChapter.c_sort_num} - {$arrGRM[9]|raw} + {$arrGrm[9]|raw} 下一页 {/if} @@ -106,7 +106,7 @@

相邻推荐: {volist name="arrNovel.n_forge_novel" id="ForgeNovel" key="key"} {if $key<19 } - {$arrGRM[$key+9]|raw} + {$arrGrm[$key+9]|raw} {/if} 上一页 {else} - {$arrGRM[10]|raw} + {$arrGrm[10]|raw} 上一页 {/if} @@ -130,7 +130,7 @@ 章节目录 | {if $arrNextChapter && $arrNextChapter.c_sort_num} - {$arrGRM[9]|raw} + {$arrGrm[9]|raw} 下一页 {/if} diff --git a/code/app/home/view/default/Pc/getNovelInfo.html b/code/app/home/view/default/Pc/getNovelInfo.html index 3063feb..57c723d 100644 --- a/code/app/home/view/default/Pc/getNovelInfo.html +++ b/code/app/home/view/default/Pc/getNovelInfo.html @@ -4,7 +4,7 @@ {block name="keywords"}{site:replace code="NOVEL@GETNOVELINFO@KEYWORDS"}{/block} {block name="description"}{site:replace code="NOVEL@GETNOVELINFO@DESCRIPTION"}{/block} {block name="head"} -{novel:info n_id="$Request.route.n_id" n_key="arrNovel" n_forge_id="0" /} +{novel:info n_id="$Request.route.intNovelId" n_key="arrNovel" n_forge_id="0" /} {site:grm page_code="pc_novel_info" diff="$arrNovel.n_id" num="100" g_key="arrGrm" /} @@ -143,7 +143,7 @@

- +

《{$arrNovel.n_name}》最新章节

diff --git a/code/app/home/view/default/Public/allChapterPage.html b/code/app/home/view/default/Public/allChapterPage.html index c2a3f26..9b8f712 100644 --- a/code/app/home/view/default/Public/allChapterPage.html +++ b/code/app/home/view/default/Public/allChapterPage.html @@ -1,10 +1,10 @@ -{if !empty($arrPaginator)} +{if !empty($page_data)}
- {volist name="arrPaginator" id="item"} + {volist name="page_data" id="item"} {eq name="item.type" value="prev"} - {$arrGRM[$key]|raw} + {$arrGrm[$key]|raw} {$item.label} @@ -13,8 +13,9 @@ {/volist} - {volist name="arrPaginator" id="item"} + {volist name="page_data" id="item"} {eq name="item.type" value="next"} - {$arrGRM[$key]|raw} + {$arrGrm[$key]|raw} {$item.label} From 6343c8d142664bdddffb8ae58711c1e6c17809b9 Mon Sep 17 00:00:00 2001 From: make Date: Sat, 19 Apr 2025 15:28:25 +0800 Subject: [PATCH 2/2] debug --- code/app/home/config/router.php | 43 ++++++-- .../view/default/Novel/getNovelChapter.html | 66 +++++++------ .../home/view/default/Pc/getNovelCatalog.html | 2 +- .../home/view/default/Pc/getNovelChapter.html | 97 +++++++++++-------- .../home/view/default/Pc/getSearchNovel.html | 22 +++-- code/app/services/ChapterService.php | 4 +- code/app/services/NovelService.php | 10 +- code/extend/template/taglib/Chapter.php | 1 + doc/TemplateTag.md | 25 ++--- 9 files changed, 154 insertions(+), 116 deletions(-) diff --git a/code/app/home/config/router.php b/code/app/home/config/router.php index b328d92..4d33c81 100644 --- a/code/app/home/config/router.php +++ b/code/app/home/config/router.php @@ -160,21 +160,37 @@ foreach ($arrRoutes['prefixes'] as $platform => $prefixes) { switch ($key) { case 'latest': //最新章节 - Route::get($strRoute, [Novel::class, 'getNovelLatestChapter']) - - ->pattern(['n_id' => '\d+', 'name' => '[\w-]+',]); + $strView = 'pc/getNovelCatalog.html'; + if ($platform == 'h5') { + $strView = 'novel/getNovelCatalog.html'; + } + Route::get($strRoute, function () use ($strView) { + return view($strView); + }) + ->pattern(['n_id' => '\d+', 'name' => '[\w-]+',]); break; case 'chapter': //章节 - Route::get($strRoute, [Novel::class, 'getNovelChapter']) - - ->pattern(['n_id' => '\d+', 'name' => '[\w-]+', 'intChapterSort' => '\d+', 'intChapterPage' => '\d+']); + $strView = 'pc/getNovelChapter.html'; + if ($platform == 'h5') { + $strView = 'novel/getNovelChapter.html'; + } + Route::get($strRoute, function () use ($strView) { + return view($strView); + }) + ->pattern(['intNovelId' => '\d+', 'name' => '[\w-]+', 'intChapterSort' => '\d+', 'intChapterPage' => '\d+']); break; + case 'kan-novel': //伪造小说详情 - Route::get($strRoute, [Novel::class, 'getKanNovelInfo']) - - ->pattern(['n_id' => '\d+', 'n_forge_id' => '\d+', 'name' => '[\w-]+',]); + $strView = 'pc/getNovelInfo.html'; + if ($platform == 'h5') { + $strView = 'novel/getNovelInfo.html'; + } + Route::get($strRoute, function () use ($strView) { + return view($strView); + }) + ->pattern(['n_id' => '\d+', 'n_forge_id' => '\d+', 'name' => '[\w-]+',]); break; case 'novel': //小说详情 @@ -243,8 +259,15 @@ foreach ($arrRoutes['prefixes'] as $platform => $prefixes) { break; case 'search': //搜素 - Route::get($strRoute, [Novel::class, 'getSearchNovel'])->ext('html'); + $strView = 'pc/getSearchNovel.html'; + if ($platform == 'h5') { + $strView = 'novel/getSearchNovel.html'; + } + Route::get($strRoute, function () use ($strView) { + return view($strView); + })->ext('html'); break; + case 'user': //用户中心 Route::get($strRoute, [User::class, 'Index']); diff --git a/code/app/home/view/default/Novel/getNovelChapter.html b/code/app/home/view/default/Novel/getNovelChapter.html index 29314a8..3f75c97 100644 --- a/code/app/home/view/default/Novel/getNovelChapter.html +++ b/code/app/home/view/default/Novel/getNovelChapter.html @@ -2,12 +2,20 @@ {block name="title"}{site:replace code="NOVEL@GETNOVELCHAPTER@TITLE"}{/block} {block name="keywords"}{site:replace code="NOVEL@GETNOVELCHAPTER@KEYWORDS"}{/block} {block name="description"}{site:replace code="NOVEL@GETNOVELCHAPTER@DESCRIPTION"}{/block} + {block name="head"} + +{site:grm page_code="pc_novel_chapter" diff="$Request.route.intChapterSort" num="100" g_key="arrGrm" /} +{novel:info n_id="$Request.route.intNovelId" n_key="arrNovel" n_forge_id="0" /} +{chapter:info n_id="$Request.route.intNovelId" c_sort_num="$Request.route.intChapterSort" +c_page="$Request.route.intChapterPage" c_key="arrChapter" /} + + - + + content='https://{$DomainModel->d_domain}{site:nurl n_id="$arrNovel.n_id" n_py="$arrNovel.n_name_pinyin" /}' /> @@ -15,17 +23,19 @@ + content='https://{$DomainModel->d_domain}{site:cpurl n_id="$arrNovel.n_id" n_py="$arrNovel.n_name_pinyin" c_sort="$arrChapter.c_sort_num"/}'> + content='https://{$DomainModel->d_domain}{site:lcpurl n_id="$arrNovel.n_id" n_py="$arrNovel.n_name_pinyin" /}'> + + {/block} @@ -82,19 +91,19 @@
  • 上一页
  • {else}
  • 上一页 + href='{site:cpurl n_id="$arrNovel.n_id" n_py="$arrNovel.n_name_pinyin" c_sort="$arrChapter.pre_chapter.c_sort_num" c_page="$arrChapter.pre_chapter.c_page"/}'>上一页
  • {/if} -
  • 章节目录
  • - {if $arrNextChapter && $arrNextChapter.c_sort_num} +
  • 章节目录
  • + {if $arrChapter.next_chapter && $arrChapter.next_chapter.c_sort_num}
  • 下一页 + href='{site:cpurl n_id="$arrNovel.n_id" n_py="$arrNovel.n_name_pinyin" c_sort="$arrChapter.next_chapter.c_sort_num" c_page="$arrChapter.next_chapter.c_page"/}'>下一页
  • {/if} @@ -147,13 +156,13 @@
  • 上一页
  • {else}
  • 上一页 + href='{site:cpurl n_id="$arrNovel.n_id" n_py="$arrNovel.n_name_pinyin" c_sort="$arrChapter.pre_chapter.c_sort_num" c_page="$arrChapter.pre_chapter.c_page"/}'>上一页
  • {/if} -
  • 章节目录
  • - {if $arrNextChapter && $arrNextChapter.c_sort_num} +
  • 章节目录
  • + {if $arrChapter.next_chapter && $arrChapter.next_chapter.c_sort_num}
  • 下一页 + href='{site:cpurl n_id="$arrNovel.n_id" n_py="$arrNovel.n_name_pinyin" c_sort="$arrChapter.next_chapter.c_sort_num" c_page="$arrChapter.next_chapter.c_page"/}'>下一页
  • {/if} @@ -163,22 +172,23 @@

    完结推荐

    - {foreach $arrEndNovel as $key=>$Novel } + {novel:list count="6" n_category="$arrNovel.n_category_pinyin" n_status="wanjie" d_key="d_key" d_val="Novel" + p_val="page_data" cache_life="86400"}
    {$Novel.n_name ?? ''} - {$Novel.n_category ?? ''}最新章节在线免费阅读

    {$Novel.n_name} + href='{site:nurl n_id="$arrNovel.n_id" n_py="$arrNovel.n_name_pinyin" /}'>{$Novel.n_name}

    作者:{$Novel.n_author}

    {$Novel.n_description}

    - {/foreach} + {/novel:list}
    @@ -186,17 +196,17 @@

    相邻小说

    - {$strFocus ?? ""} 。看小说就来{$DomainModel->d_name} {$DomainModel->d_domain}... + {$arrNovel.strFocus ?? ""} 。看小说就来{$DomainModel->d_name} {$DomainModel->d_domain}...
    - {volist name='arrRelateveNovel' id='Novel'} + {volist name='arrNovel.arrRelateveNovel' id='Novel'} {$Novel.n_name}   + href='{site:nurl n_id="$Novel.n_id" n_py="$Novel.n_name_pinyin" /}'>{$Novel.n_name}   {/volist} - {volist name='arrNovel.n_forge_novel' id='ForgeNovel'} + {volist name="arrNovel.n_forge_novel" id="ForgeNovel" key="key"} {$ForgeNovel.n_forge_title}   + href='{site:nnurl n_id="$arrNovel.n_id" n_py="$arrNovel.n_name_pinyin" n_fid="$ForgeNovel.n_forge_id"/}'>{$ForgeNovel.n_forge_title}   {/volist}
    diff --git a/code/app/home/view/default/Pc/getNovelCatalog.html b/code/app/home/view/default/Pc/getNovelCatalog.html index 7eee326..f6bce4d 100644 --- a/code/app/home/view/default/Pc/getNovelCatalog.html +++ b/code/app/home/view/default/Pc/getNovelCatalog.html @@ -4,7 +4,7 @@ {block name="description"}{site:replace code="NOVEL@GETNOVELCATALOG@DESCRIPTION"}{/block} {block name="head"} {novel:info n_id="$Request.route.intNovelId" n_key="arrNovel" n_forge_id="0" /} -{site:grm page_code="pc_novel_info" diff="$arrNovel.n_id" num="100" g_key="arrGrm" /} +{site:grm page_code="pc_novel_catalog" diff="$arrNovel.n_id" num="100" g_key="arrGrm" /} diff --git a/code/app/home/view/default/Pc/getNovelChapter.html b/code/app/home/view/default/Pc/getNovelChapter.html index 64bf1bf..cdc6e5f 100644 --- a/code/app/home/view/default/Pc/getNovelChapter.html +++ b/code/app/home/view/default/Pc/getNovelChapter.html @@ -4,10 +4,16 @@ {block name="description"}{site:replace code="NOVEL@GETNOVELCHAPTER@DESCRIPTION"}{/block} {block name="head"} +{site:grm page_code="pc_novel_chapter" diff="$Request.route.intChapterSort" num="100" g_key="arrGrm" /} +{novel:info n_id="$Request.route.intNovelId" n_key="arrNovel" n_forge_id="0" /} +{chapter:info n_id="$Request.route.intNovelId" c_sort_num="$Request.route.intChapterSort" +c_page="$Request.route.intChapterPage" c_key="arrChapter" /} + + - + + content='https://{$DomainModel->d_domain}{$strPcPath}{site:nurl n_id="$arrNovel.n_id" n_py="$arrNovel.n_name_pinyin" /}' /> @@ -15,18 +21,18 @@ + content='https://{$DomainModel->d_domain}{$strPcPath}{site:cpurl n_id="$arrNovel.n_id" n_py="$arrNovel.n_name_pinyin" c_sort="$arrChapter.c_sort_num"/}'> + content='https://{$DomainModel->d_domain}{$strPcPath}{site:lcpurl n_id="$arrNovel.n_id" n_py="$arrNovel.n_name_pinyin" /}'> - + {/block} + {block name="head-css"} + href='https://{$DomainModel->d_domain}{$strPcPath}{site:cpurl n_id="$arrNovel.n_id" n_py="$arrNovel.n_name_pinyin" c_sort="$arrChapter.c_sort_num"/}'> {/block} {block name="head-js"} @@ -76,8 +83,9 @@

    {$DomainModel->d_name}>{$arrNovel.n_name} > - {$arrNovel.n_name}(第{$arrChapter.c_sort_num}页) + href='{$strPcPath}{site:nurl n_id="$arrNovel.n_id" n_py="$arrNovel.n_name_pinyin" /}'>{$arrNovel.n_name} + > + {$arrNovel.n_name}(第{$arrChapter.c_sort_num}页)

    {$arrNovel.n_name}(第{$arrChapter['c_sort_num']}页)

    @@ -87,15 +95,16 @@ {else} {$arrGrm[10]|raw} 上一页 + href='{$strPcPath}{site:cpurl n_id="$arrNovel.n_id" n_py="$arrNovel.n_name_pinyin" c_sort="$arrChapter.pre_chapter.c_sort_num" c_page="$arrChapter.pre_chapter.c_page"/}'>上一页 {/if} | - 章节目录 + 章节目录 | - {if $arrNextChapter && $arrNextChapter.c_sort_num} + {if $arrChapter.next_chapter && $arrChapter.next_chapter.c_sort_num} {$arrGrm[9]|raw} 下一页 + href='{$strPcPath}{site:cpurl n_id="$arrNovel.n_id" n_py="$arrNovel.n_name_pinyin" c_sort="$arrChapter.next_chapter.c_sort_num" c_page="$arrChapter.next_chapter.c_page"/}'>下一页 {/if}
    @@ -104,65 +113,67 @@

    请勿开启浏览器阅读模式,否则将导致章节内容缺失及无法阅读下一页。

    相邻推荐: - {volist name="arrNovel.n_forge_novel" id="ForgeNovel" key="key"} - {if $key<19 } - {$arrGrm[$key+9]|raw} - {/if} - {$ForgeNovel.n_forge_title} - {/volist} + {volist name="arrNovel.n_forge_novel" id="ForgeNovel" key="key"} + {if $key<19 } {$arrGrm[$key+9]|raw} {/if} {$ForgeNovel.n_forge_title} + {/volist} - {volist name='arrRelateveNovel' id='Novel'} - {$Novel.n_name}   - {/volist} + {volist name='arrNovel.arrRelateveNovel' id='Novel'} + {$Novel.n_name}   + {/volist} -

    +

    {if $arrChapter && $arrChapter.c_sort_num && $arrChapter.c_sort_num == 1} 上一页 {else} {$arrGrm[10]|raw} 上一页 + href='{$strPcPath}{site:cpurl n_id="$arrNovel.n_id" n_py="$arrNovel.n_name_pinyin" c_sort="$arrChapter.pre_chapter.c_sort_num" c_page="$arrChapter.pre_chapter.c_page"/}'>上一页 {/if} | - 章节目录 + 章节目录 | - {if $arrNextChapter && $arrNextChapter.c_sort_num} + {if $arrChapter.next_chapter && $arrChapter.next_chapter.c_sort_num} {$arrGrm[9]|raw} 下一页 + href='{$strPcPath}{site:cpurl n_id="$arrNovel.n_id" n_py="$arrNovel.n_name_pinyin" c_sort="$arrChapter.next_chapter.c_sort_num" c_page="$arrChapter.next_chapter.c_page"/}'>下一页 {/if}
    -

    已完结热门小说推荐

    -
    +

    已完结热门小说推荐

    +
    read_btn - {foreach $arrEndNovel as $key=>$Novel } -
    + {novel:list count="6" n_category="$arrNovel.n_category_pinyin" n_status="wanjie" d_key="d_key" d_val="Novel" + p_val="page_data" cache_life="86400"} + - {/foreach} -
    -
    + + {/novel:list} + +
    +
    {/block} diff --git a/code/app/home/view/default/Pc/getSearchNovel.html b/code/app/home/view/default/Pc/getSearchNovel.html index 7a77dbd..55920ac 100644 --- a/code/app/home/view/default/Pc/getSearchNovel.html +++ b/code/app/home/view/default/Pc/getSearchNovel.html @@ -12,17 +12,21 @@
    -

    {$strSearchKeywords}搜索结果 - {$DomainModel->d_name} 第{$intPage}页

    +

    {$Request.get.keyword}搜索结果 - {$DomainModel->d_name} 第{$Request.get.page}页

    - 搜索“{$strSearchKeywords}”相关结果共有 {$arrPage.total} 部小说 + 搜索“{$Request.get.keyword}”相关结果共有 {$total} 部小说
    - {if empty($arrPage.data)} + {if $total <1}

    没有相关数据

    {else}
    - {foreach $arrPage.data as $key=>$Novel} + {novel:pager page="$Request.get.page" limit="30" + key="$Request.get.keyword" + d_key="d_key" + d_val="Novel" n_num="total" + p_val="page_data" button_num="10" cache_life="86400" func="generateSearchPager"} @@ -51,17 +55,17 @@
    - {volist name="arrPaginator" id="vo" key="k"} + {volist name="page_data" id="vo" key="k"} {switch $vo.label} {case value="上一页"} - {if $intPage == 1} + {if $Request.get.page == 1} « {else} « {/if} {/case} {case value="下一页"} - {if $intPage >= $intTotalPage} + {if $Request.get.page >= $total} » {else} » diff --git a/code/app/services/ChapterService.php b/code/app/services/ChapterService.php index 2268065..957bdc8 100644 --- a/code/app/services/ChapterService.php +++ b/code/app/services/ChapterService.php @@ -218,7 +218,7 @@ class ChapterService { // 小说详情 $arrNovel = $this->NovelModel->getNovelByNId($intNId); - + // 章节 $ChapterModel = ChapterModel::getInstance(); $arrFilter = ['n_id' => $intNId, 'c_sort_num' => $intCSortNum, 'c_page' => $intCPage]; @@ -244,7 +244,7 @@ class ChapterService $arrChapter['pre_chapter'] = $arrPreChapter; $arrChapter['next_chapter'] = $arrNextChapter; - + // var_dump($arrChapter['c_name']);exit; // 更新值 ConverterMovel::setVal([ 'intPage' => 1, diff --git a/code/app/services/NovelService.php b/code/app/services/NovelService.php index 8aa3023..bb22b05 100644 --- a/code/app/services/NovelService.php +++ b/code/app/services/NovelService.php @@ -417,7 +417,7 @@ class NovelService } # n_category_sex_zh filter - if (!empty($strKey)) { + if (!empty($strNSex)) { $strKey = mb_substr($strKey, 0, 30); $arrFilter['$and'][] = [ @@ -454,10 +454,6 @@ class NovelService $strCacheKey = ''; $intLifeTime = 0; - if (empty($arrFilter['$and'])) { - $arrFilter = []; - } - # cache filter if ($intCacheLifeTime > 0) { $strCacheKey = sprintf( @@ -472,7 +468,7 @@ class NovelService $intLifeTime = $intLifeTime; } - + $arrNovel = $this->NovelModel->findPaginatedWithCache( $arrFilter, $intPage, @@ -483,7 +479,7 @@ class NovelService ); $arrPager = call_user_func([$this, $Func], $arrParams, $arrSort, $arrNovel); - + $arrResult = [ 'data' => $arrNovel['data'] ?? [], 'pages' => $arrNovel['pages'] ?? 0, diff --git a/code/extend/template/taglib/Chapter.php b/code/extend/template/taglib/Chapter.php index a9ab90f..f18cb85 100644 --- a/code/extend/template/taglib/Chapter.php +++ b/code/extend/template/taglib/Chapter.php @@ -157,6 +157,7 @@ EOT; {$c_page} ); + \${$c_key} = \$arrChapter ?? []; ?> EOT; diff --git a/doc/TemplateTag.md b/doc/TemplateTag.md index 5ecc07a..1b5fe9b 100644 --- a/doc/TemplateTag.md +++ b/doc/TemplateTag.md @@ -108,6 +108,7 @@ $sort_type ?? "all"; # 排序方式 $n_status ?? "all"; # 查询状态 $n_sex ?? "all"; # 查询性别 + $key ?? ""; # 查询 搜索 $button_num ?? "10"; # 分页按钮数量 $diff_key ?? ""; # 缓存键值差异 $cache_life ?? '0'; # 缓存时间,如果需要开启缓存,这个字段必须传,而且必须大于0 @@ -115,7 +116,7 @@ $d_val ?? 'd_val'; # 查询出来的数据遍历的时候, 值的名称 $p_val ?? 'p_val'; # 分页页码数据,这是一个数组。和之前控制器渲染的那个数组一致的。 $n_num ?? 'n_num'; # 数据总量。和之前控制器渲染的那个 intTotalPage 一致的。 - $func ; # 这个参数是一个回调方法名,用来渲染分页页码数据的,该方法需要在 NovelService 类里面实现,func(array $arrParams, array $arrSort, array $arrNovel) + $func ; # 这个参数是一个回调方法名,用来渲染分页页码数据的,该方法需要在 NovelService 类里面实现,func(array $arrParams, array $arrSort, array $arrNovel) generateCategoryPager generateSearchPager # 样例 {novel:pager page="1" limit="10" n_category="$Request.route.category" d_key="d_key" d_val="novel" p_val="page_data" button_num="3" cache_life="1000" func="generateSearchPager"}
  • @@ -201,23 +202,15 @@ {/chapter:list} -# 10、 获取指定小说多个章节数据并且遍历 +# 10、 获取小说章节详情数据 # 传参与默认值(传参用下面的变量名,名称不需要$符号, 值的话如果用第三方变量作为值,需要带$符号): - $count ?? '10'; # 查询条数 - $n_id ; # 小说ID - $sort_type ?? "all"; # 排序方式 - $diff_key ?? ""; # 缓存键值差异 - $cache_life ?? '0'; # 缓存时间,如果需要开启缓存,这个字段必须传,而且必须大于0 - $d_key ?? 'd_key'; # 查询出来的数据遍历的时候, 下标键变量的名称 - $d_val ?? 'd_val'; # 查询出来的数据遍历的时候, 值的名称 + $n_id ; # 传入的小说ID + $c_sort_num ; # 传入的章节索引 + $c_page ; # 传入的章节页码 + $n_key ; # 查询出来的数据待使用的变量名称 # 样例 -{chapter:list count="10" n_id="$Request.get.n_id" d_key="d_key" d_val="chapter" cache_life="1000"} -
  • - Index: {$d_key} - 章节名称: {$chapter.c_name} - 章节序号: {$chapter.c_sort_num} -
  • -{/chapter:list} +{chapter:info n_id="1" c_sort_num="200" c_page="0" c_key="arrChapter01" /} +{$arrChapter01.c_name} # 11、 获取指定小说分页数据并且遍历