diff --git a/code/app/home/config/router.php b/code/app/home/config/router.php
index 1c10d98..327cc9f 100644
--- a/code/app/home/config/router.php
+++ b/code/app/home/config/router.php
@@ -128,7 +128,6 @@ $arrRoutes = [
* 完整路由
* 使用: {site:nflurl gender="$strGender" category="$CategoryPinyin" status="all" order="all" page="1"/}
*/
- // '/shuku/:strGender?/:strCategory?/:strStatus?/:strOrder?/page:intPage?',
'/shuku/:strGender/:strCategory/:strStatus/:strOrder/page:intPage',
'/books/:strGender/:strCategory/:strStatus/:strOrder/page:intPage',
'/library/:strGender/:strCategory/:strStatus/:strOrder/page:intPage',
@@ -218,6 +217,27 @@ $arrRoutes = [
'/class/index',
'/category/index',
],
+ // 排行榜列表url
+ 'rank-info' => [
+ /**
+ * /paihang/nansheng-xiaoshuo/all/all/all/page1
+ * 使用: {site:nflurl gender="$strGender" category="$CategoryPinyin" status="all" order="all" page="1"/}
+ */
+ '/paihang/:strGender/:strCategory/:strStatus/:strOrder/page:intPage',
+ '/rank/:strGender/:strCategory/:strStatus/:strOrder/page:intPage',
+ '/top/:strGender/:strCategory/:strStatus/:strOrder/page:intPage',
+ '/ranks/:strGender/:strCategory/:strStatus/:strOrder/page:intPage',
+ '/phb/:strGender/:strCategory/:strStatus/:strOrder/page:intPage',
+ '/paihangbang/:strGender/:strCategory/:strStatus/:strOrder/page:intPage',
+
+ '/paihang/:strCategory/:strStatus/:strOrder/page:intPage',
+ '/rank/:strCategory/:strStatus/:strOrder/page:intPage',
+ '/top/:strCategory/:strStatus/:strOrder/page:intPage',
+ '/ranks/:strCategory/:strStatus/:strOrder/page:intPage',
+ '/phb/:strCategory/:strStatus/:strOrder/page:intPage',
+ '/paihangbang/:strCategory/:strStatus/:strOrder/page:intPage',
+
+ ],
//排行榜
'rank' => ['/paihang/all', '/rank/all', '/paihang-quan', '/top/all', '/paihang-bang', '/ranks/all'],
// 男生
@@ -329,7 +349,6 @@ foreach ($arrRoutes['prefixes'] as $platform => $prefixes) {
'intPage' => '\d*', // 允许空值
// 'strCategory' => 'all|xuanhuan-xiuzhen|junshi-xiaoshuo|wangyou-xiaoshuo|kehuan-xiaoshuo|hongsheng-chuanyue|dushi-xiaoshuo|lingyi-xiaoshuo|yanqing-xiaoshuo|qita-xiaoshuo',
-
]);
break;
@@ -354,7 +373,24 @@ foreach ($arrRoutes['prefixes'] as $platform => $prefixes) {
return view($strView);
});
break;
+ case 'rank-info':
+ //排行榜
+ $strView = 'pc/getNovelRank.html';
+ if ($platform == 'h5') {
+ $strView = 'novel/getNovelRank.html';
+ }
+ Route::get($strRoute, function () use ($strView) {
+ return view($strView);
+ })->pattern([
+ 'strGender' => '[a-z\-]*', // 允许空值
+ 'strCategory' => '[a-z\-]*', // 允许空值
+ 'strStatus' => '(all|lianzai|wanjie)?', // 允许空值
+ 'strOrder' => '[a-z\-]*', // 允许空值
+ 'intPage' => '\d*', // 允许空值
+ ]);
+ break;
+
case 'boys':
//男生
$strView = 'pc/getNovelChannel.html';
diff --git a/code/app/home/view/shikong/baseH5.html b/code/app/home/view/shikong/baseH5.html
index 0c13ee3..cb060d7 100644
--- a/code/app/home/view/shikong/baseH5.html
+++ b/code/app/home/view/shikong/baseH5.html
@@ -2,6 +2,8 @@
+ {block name="get-data"}
+{/block}
{block name="title"}{/block}
@@ -42,8 +44,8 @@
-
-
+
+
{block name="head-js"}{/block}
@@ -72,7 +74,7 @@
-
+
+
+
+
+
+ {novel:sort d_key="key" d_val="strSortName"}
+
+
+ {/novel:sort}
+
-
{$strCategoryName}
- {/novel:category}
-
-
- 排序:
- {novel:sort d_key="key" d_val="strSortName"}
- {$strSortName}
- {/novel:sort}
-
-
- 状态:
- {novel:status d_key="key" d_val="strStatusName"}
- {$strStatusName}
- {/novel:status}
-
-
-
-
更新列表
-
- {foreach $resData.data as $key=>$Novel}
+
-
- [{$Novel.n_category}]
-
- {$arrGrm[$key]|raw}
-
- {$Novel.n_name}
-
-
- {$Novel.n_author}
- {:date('m-d')}
-
- {/foreach}
-
-
+
+
+
+
+
+ {foreach $resData.data as $key=>$Novel}
+ {include file="public/novel-list" /}
+ {/foreach}
+
+
+
+
+
-
- {volist name="resData.p_data.pager" id="vo" key="k"}
- {switch $vo.label}
- {case value="上一页"}
- {if $resData.p_data.page == 1}
-
«
- {else}
-
«
- {/if}
- {/case}
- {case value="下一页"}
- {if $resData.p_data.page >= $resData.p_data.total}
-
»
- {else}
-
»
- {/if}
- {/case}
- {default /}
- {if preg_match('/^\d+$/', $vo.label)}
-
{$vo.label}
- {/if}
- {/switch}
- {/volist}
-
-
-
-
- 封面推荐
-
-
- {novel:list count="8" sort_type="tuijian" d_key="d_key" d_val="Novel" p_val="page_data" cache_life="86400"}
-
-
- {$arrGrm[$d_key+30]|raw}
-
-
-
-
-
-
- 作者:{$Novel.n_author}
- {$Novel.n_description}
-
-
- {/novel:list}
-
+
diff --git a/code/app/home/view/shikong/novel/getNovelRank.html b/code/app/home/view/shikong/novel/getNovelRank.html
new file mode 100644
index 0000000..5966c11
--- /dev/null
+++ b/code/app/home/view/shikong/novel/getNovelRank.html
@@ -0,0 +1,114 @@
+{extend name="baseH5" /}
+
+{block name="get-data"}
+{site:helper func="initRankTKD" /}
+{/block}
+
+{block name="title"}{site:replace code="NOVEL@GETNOVELRANK@TITLE"}{/block}
+{block name="keywords"}{site:replace code="NOVEL@GETNOVELRANK@KEYWORDS"}{/block}
+{block name="description"}{site:replace code="NOVEL@GETNOVELRANK@DESCRIPTION"}{/block}
+
+{block name="head"}
+
+
+
+
+
+
+
+{/block}
+{block name="head-js"}{/block}
+
+{block name="logo-html"}
+
+{/block}
+
+{block name="strPageCode"}
+
+{/block}
+
+
+{block name="main"}
+
+{site:grm page_code="h5_rank" diff="0" num="100" g_key="arrGrm" /}
+
+
+
+
+
+
+
+
+ {novel:ranklist count="10" sort_type="$Request.route.strOrder" n_status="$Request.route.strStatus" d_key="d_key" d_val="Novel" cache_life="86400"}
+
+ {/novel:ranklist}
+
+
+
+
+
+
+
+{/block}
+
+{block name="customize"} {/block}
\ No newline at end of file
diff --git a/code/app/home/view/shikong/public/footer.html b/code/app/home/view/shikong/public/footer.html
index 0a03808..3af5ac7 100644
--- a/code/app/home/view/shikong/public/footer.html
+++ b/code/app/home/view/shikong/public/footer.html
@@ -1,24 +1,30 @@
-
+
+
+
+
+
+
diff --git a/code/app/home/view/shikong/public/index-item-head.html b/code/app/home/view/shikong/public/index-item-head.html
new file mode 100644
index 0000000..2af1830
--- /dev/null
+++ b/code/app/home/view/shikong/public/index-item-head.html
@@ -0,0 +1,16 @@
+
+
\ No newline at end of file
diff --git a/code/app/home/view/shikong/public/novel-list-flex.html b/code/app/home/view/shikong/public/novel-list-flex.html
new file mode 100644
index 0000000..62a623d
--- /dev/null
+++ b/code/app/home/view/shikong/public/novel-list-flex.html
@@ -0,0 +1,18 @@
+
+
+
+
+ {if isset($showIconStatus) && $showIconStatus == 'paixu'}
+
{$key + 1}
+ {/if}
+
+ {if isset($showIconStatus) && $showIconStatus == 'zhuantai'}
+
{$Novel.n_status}
+ {/if}
+
+
+
{$Novel.n_name}
+
+
\ No newline at end of file
diff --git a/code/app/home/view/shikong/public/novel-list.html b/code/app/home/view/shikong/public/novel-list.html
new file mode 100644
index 0000000..34f3376
--- /dev/null
+++ b/code/app/home/view/shikong/public/novel-list.html
@@ -0,0 +1,25 @@
+
\ No newline at end of file
diff --git a/code/app/services/NovelService.php b/code/app/services/NovelService.php
index 3091790..1eb2a45 100644
--- a/code/app/services/NovelService.php
+++ b/code/app/services/NovelService.php
@@ -170,6 +170,32 @@ class NovelService
}
+ /**
+ * 排行榜url
+ * Undocumented function
+ *
+ * @param [type] $strGender
+ * @param [type] $strCategory
+ * @param [type] $strStatus
+ * @param [type] $strOrder
+ * @param [type] $intPage
+ * @return string
+ */
+ public function getNovelRankUrl($strGender, $strCategory, $strStatus, $strOrder, $intPage): string
+ {
+ $strKey = 'RANK_LIST_URL';
+ $strUrl = $this->getPageUrl($strKey, [
+ 'strGender' => !empty($strGender) ? $strGender : '',
+ 'strCategory' => !empty($strCategory) ? $strCategory : 'all',
+ 'strStatus' => !empty($strStatus) ? $strStatus : 'all',
+ 'strOrder' => !empty($strOrder) ? $strOrder : 'all',
+ 'intPage' => $intPage ?? 1,
+ ]);
+
+ $strUrl = preg_replace('#/{2,}#', '/', $strUrl);
+ return (string)$strUrl;
+ }
+
/**
* Undocumented function
@@ -217,7 +243,7 @@ class NovelService
'update' => '最新更新',
];
- public $arrRankSortType = [
+ static $arrRankSortType = [
'daily' => '天',
'weekly' => '周',
'monthly' => '月',
diff --git a/code/app/services/SiteContext.php b/code/app/services/SiteContext.php
index 49140ea..eb98334 100644
--- a/code/app/services/SiteContext.php
+++ b/code/app/services/SiteContext.php
@@ -303,6 +303,22 @@ class SiteContext
]);
}
+ /**
+ * 视图反向控制器(注释函数),在视图开头调用,用来初始化一些操作。这里尽量不要复杂逻辑。这是个样例
+ *
+ * @return void
+ */
+ public function initRankTKD()
+ {
+ $strOrder = $this->Request->param('strOrder');
+ $strStatus = $this->Request->param('strStatus');
+ ConverterMovel::setVal([
+ 'intPage' => 1,
+ 'strNovelOrder' => NovelService::$arrRankSortType[$strOrder] ,
+ 'strNovelStatus' => NovelService::$arrStatus[$strStatus] ,
+ ]);
+ }
+
}
diff --git a/code/database/seeders/TemplateSeeder.php b/code/database/seeders/TemplateSeeder.php
index 40540e6..6b77391 100644
--- a/code/database/seeders/TemplateSeeder.php
+++ b/code/database/seeders/TemplateSeeder.php
@@ -316,6 +316,13 @@ class TemplateSeeder
'/search.html',
]
],
+ 'RANK_LIST_URL' => [
+ 'description' => '排行榜列表URL 模板1',
+ 'sfg_id' => 120,
+ 'arrSubjectFomart' => [
+ '/paihang/{strGender}/{strCategory}/{strStatus}/{strOrder}/page{intPage}',
+ ]
+ ],
// SEO 丰富内容
diff --git a/code/extend/template/taglib/Site.php b/code/extend/template/taglib/Site.php
index 0749d24..2b4dd0d 100644
--- a/code/extend/template/taglib/Site.php
+++ b/code/extend/template/taglib/Site.php
@@ -16,6 +16,7 @@ class Site extends TagLib
'lcpurl' => ['attr' => 'n_id,n_py', 'close' => 0],
'nclurl' => ['attr' => 'n_id,n_py,order,page', 'close' => 0],
'nflurl' => ['attr' => 'gender,category,status,order,page', 'close' => 0],
+ 'rankurl' => ['attr' => 'gender,category,status,order,page', 'close' => 0],
'grm' => ['attr' => 'domain,code,line,diff,start,end,index,type', 'close' => 0],
'replace' => ['attr' => 'code,diff', 'close' => 0],
@@ -319,6 +320,35 @@ EOD;
return $strParse;
}
+ /**
+ * 排行榜 URL生成器
+ *
+ * @param array
+ * @return string
+ */
+ public function tagRankUrl($tag)
+ {
+ $strGender = isset($tag['gender']) ? $tag['gender'] : '';
+ $strCategory = isset($tag['category']) ? $tag['category'] : 'all';
+ $strStatus = isset($tag['status']) ? $tag['status'] : 'all';
+ $strOrder = isset($tag['order']) ? $tag['order'] : '';
+ $intPage = isset($tag['page']) ? $tag['page'] : 1;
+
+ $strGender = $this->customBuildVar($strGender);
+ $strCategory = $this->customBuildVar($strCategory);
+ $strStatus = $this->customBuildVar($strStatus);
+ $strOrder = $this->customBuildVar($strOrder);
+ $intPage = $this->customBuildVar($intPage);
+
+ $strParse = <<getNovelRankUrl({$strGender},{$strCategory},{$strStatus},{$strOrder},{$intPage});
+ echo \$strUrl;
+?>
+EOD;
+ return $strParse;
+ }
+
/**
* 搜索页URL生成器
*
diff --git a/code/public/initdata/novel/getRank/description.php b/code/public/initdata/novel/getRank/description.php
index d4559da..ea8dbeb 100644
--- a/code/public/initdata/novel/getRank/description.php
+++ b/code/public/initdata/novel/getRank/description.php
@@ -1,105 +1,105 @@
[
+ 'description' => '排行榜列表URL 模板2',
+ 'sfg_id' => 120,
+ 'arrSubjectFomart' => [
+ '/paihangbang/{strGender}/{strCategory}/{strStatus}/{strOrder}/page{intPage}',
+ ]
+ ],
+ 'RANK_LIST_URL_T3' => [
+ 'description' => '排行榜列表URL 模板3',
+ 'sfg_id' => 120,
+ 'arrSubjectFomart' => [
+ '/rank/:strGender/:strCategory/:strStatus/:strOrder/page:intPage',
+ ]
+ ],
+ 'RANK_LIST_URL_T4' => [
+ 'description' => '排行榜列表URL 模板4',
+ 'sfg_id' => 120,
+ 'arrSubjectFomart' => [
+ '/top/:strGender/:strCategory/:strStatus/:strOrder/page:intPage',
+ ]
+ ],
+ 'RANK_LIST_URL_T5' => [
+ 'description' => '排行榜列表URL 模板5',
+ 'sfg_id' => 120,
+ 'arrSubjectFomart' => [
+ '/ranks/:strGender/:strCategory/:strStatus/:strOrder/page:intPage',
+ ]
+ ],
+ 'RANK_LIST_URL_T6' => [
+ 'description' => '排行榜列表URL 模板6',
+ 'sfg_id' => 120,
+ 'arrSubjectFomart' => [
+ '/phb/:strGender/:strCategory/:strStatus/:strOrder/page:intPage',
+ ]
+ ],
// 最新替换模板分组id 119
diff --git a/code/public/template/shikong/js/channel.min.js b/code/public/template/shikong/js/channel.min.js
index 86f40dc..df64053 100644
--- a/code/public/template/shikong/js/channel.min.js
+++ b/code/public/template/shikong/js/channel.min.js
@@ -407,5 +407,5 @@ function isPC() {
}
//init
-channelPv.init()
-channelPv2.init()
\ No newline at end of file
+// channelPv.init()
+// channelPv2.init()
\ No newline at end of file
diff --git a/doc/TemplateTag.md b/doc/TemplateTag.md
index b9d0d81..ee73851 100644
--- a/doc/TemplateTag.md
+++ b/doc/TemplateTag.md
@@ -22,6 +22,7 @@
# 小说分类 url
{site:nflurl gender="$arrNovel[gender]" category="$arrNovel[category]" status="$arrNovel[status]" page="1"/}
{site:nflurl gender="all" category="$arrNovel[category_pinyin]" status="all" page="1"/}
+{site:nflurl order="tuijian" page="1"/}
# 小说详情 url
{site:nurl n_id="$Novel->n_id" n_py="$Novel->n_name_pinyin"/}
@@ -41,6 +42,10 @@
# 搜索详情 url
{site:souurl key="哈哈" p="1"/}
+# 排行榜列表url
+{site:rankurl gender="$arrNovel[gender]" category="$arrNovel[category]" status="$arrNovel[status]" order="$arrNovel[order]" page="1"/}
+{site:rankurl status="$arrNovel[status]" order="$arrNovel[order]" page="1"/}
+
# 干扰码
{site:grm domain="Request->DomainModel->d_domain" code="kuangyu-pc-index" line="50" diff="0" start="5" end="20" type="2" /}