This commit is contained in:
Default
2025-04-01 10:52:55 +08:00
parent c7978968f3
commit 85d1d8b6c7
5 changed files with 79 additions and 208 deletions

View File

@@ -14,89 +14,34 @@ use app\Request;
class Index extends BaseController
{
// 首页-H5
/**
* 首页-H5
*
* @param Request $Request
* @return void
*/
public function index(Request $Request)
{
// 获取路由附加的参数
$boolIsMobile = $Request->param('boolIsMobile');
// 模拟数据-推荐等级为9的 随机8个小说
$arrRecommendNovel = [
['id' => 1, 'name' => '小说1', 'author' => '作者1'],
['id' => 2, 'name' => '小说2', 'author' => '作者2'],
['id' => 3, 'name' => '小说3', 'author' => '作者3'],
['id' => 4, 'name' => '小说3', 'author' => '作者3'],
['id' => 5, 'name' => '小说3', 'author' => '作者3'],
['id' => 6, 'name' => '小说3', 'author' => '作者3'],
['id' => 7, 'name' => '小说3', 'author' => '作者3'],
['id' => 8, 'name' => '小说3', 'author' => '作者3'],
$NovelModel = new NovelModel;
];
// 推荐等级为9的连载的 随机15个小说
$strKey = $Request->DomainModel->d_domain . ':H5:';
$arrRecommendNovel = $NovelModel->getHighLevelNovelOnCache($strKey, 8);
// 模拟数据-最新 随机8个小说
$arrNewsNovel = [
['id' => 1, 'name' => '小说1', 'author' => '作者1'],
['id' => 2, 'name' => '小说2', 'author' => '作者2'],
['id' => 3, 'name' => '小说3', 'author' => '作者3'],
['id' => 4, 'name' => '小说3', 'author' => '作者3'],
['id' => 5, 'name' => '小说3', 'author' => '作者3'],
['id' => 6, 'name' => '小说3', 'author' => '作者3'],
['id' => 7, 'name' => '小说3', 'author' => '作者3'],
['id' => 8, 'name' => '小说3', 'author' => '作者3'],
];
$arrNewsNovel = $NovelModel->getSexNovelOnCache($strKey, 8, 0);
$arrDayRankNovel = $NovelModel->getRankNovelOnCache($strKey, 10, 0, 'daily');
$arrWeekRankNovel = $NovelModel->getRankNovelOnCache($strKey, 10, 0, 'weekly');
$arrMoonRankNovel = $NovelModel->getRankNovelOnCache($strKey, 10, 0, 'monthly');
$strStatus = '已完结';
$arrEndNovelRankNovel = $NovelModel->getRankNovelOnCache($strKey, 10, 0, 'total',$strStatus);
// 模拟数据-日排行榜 随机10个小说
$arrDayRankNovel = [
['id' => 1, 'name' => '小说1', 'author' => '作者1'],
['id' => 2, 'name' => '小说2', 'author' => '作者2'],
['id' => 3, 'name' => '小说3', 'author' => '作者3'],
['id' => 4, 'name' => '小说3', 'author' => '作者3'],
['id' => 5, 'name' => '小说3', 'author' => '作者3'],
['id' => 6, 'name' => '小说3', 'author' => '作者3'],
['id' => 7, 'name' => '小说3', 'author' => '作者3'],
['id' => 8, 'name' => '小说3', 'author' => '作者3'],
['id' => 9, 'name' => '小说3', 'author' => '作者3'],
['id' => 10, 'name' => '小说3', 'author' => '作者3'],
];
// 模拟数据-周排行榜 随机10个小说
$arrWeekRankNovel = [
['id' => 1, 'name' => '小说1', 'author' => '作者1'],
['id' => 2, 'name' => '小说2', 'author' => '作者2'],
['id' => 3, 'name' => '小说3', 'author' => '作者3'],
['id' => 4, 'name' => '小说3', 'author' => '作者3'],
['id' => 5, 'name' => '小说3', 'author' => '作者3'],
['id' => 6, 'name' => '小说3', 'author' => '作者3'],
['id' => 7, 'name' => '小说3', 'author' => '作者3'],
['id' => 8, 'name' => '小说3', 'author' => '作者3'],
['id' => 9, 'name' => '小说3', 'author' => '作者3'],
['id' => 10, 'name' => '小说3', 'author' => '作者3'],
];
// 模拟数据-月排行榜 随机10个小说
$arrMoonRankNovel = [
['id' => 1, 'name' => '小说1', 'author' => '作者1'],
['id' => 2, 'name' => '小说2', 'author' => '作者2'],
['id' => 3, 'name' => '小说3', 'author' => '作者3'],
['id' => 4, 'name' => '小说3', 'author' => '作者3'],
['id' => 5, 'name' => '小说3', 'author' => '作者3'],
['id' => 6, 'name' => '小说3', 'author' => '作者3'],
['id' => 7, 'name' => '小说3', 'author' => '作者3'],
['id' => 8, 'name' => '小说3', 'author' => '作者3'],
['id' => 9, 'name' => '小说3', 'author' => '作者3'],
['id' => 10, 'name' => '小说3', 'author' => '作者3'],
];
// 模拟数据-完结小说 总排行榜 随机10个小说
$arrEndNovelRankNovel = [
['id' => 1, 'name' => '小说1', 'author' => '作者1'],
['id' => 2, 'name' => '小说2', 'author' => '作者2'],
['id' => 3, 'name' => '小说3', 'author' => '作者3'],
['id' => 4, 'name' => '小说3', 'author' => '作者3'],
['id' => 5, 'name' => '小说3', 'author' => '作者3'],
['id' => 6, 'name' => '小说3', 'author' => '作者3'],
['id' => 7, 'name' => '小说3', 'author' => '作者3'],
['id' => 8, 'name' => '小说3', 'author' => '作者3'],
['id' => 9, 'name' => '小说3', 'author' => '作者3'],
['id' => 10, 'name' => '小说3', 'author' => '作者3'],
];
View::assign([
'arrRecommendNovel' => $arrRecommendNovel,

View File

@@ -14,14 +14,14 @@ use app\Request;
use template\page\CusteomPage02;
class Novel extends BaseController
{
public function index()
{
return View::fetch();
}
// 小说排行
/**
* 小说排行
*
* @param Request $Request
* @return void
*/
public function getNovelRank(Request $Request)
{
$boolIsMobile = $Request->param('boolIsMobile');
@@ -219,25 +219,17 @@ class Novel extends BaseController
return View::fetch($strTemplate);
}
// 书架
/**
* 书架
*
* @param Request $Request
* @return void
*/
public function getBookShelf(Request $Request)
{
$boolIsMobile = $Request->param('boolIsMobile');
// 模拟数据
$arrNewsNovel = [
['id' => 1, 'name' => '小说1', 'author' => '作者1'],
['id' => 2, 'name' => '小说2', 'author' => '作者2'],
['id' => 3, 'name' => '小说3', 'author' => '作者3'],
['id' => 4, 'name' => '小说3', 'author' => '作者3'],
['id' => 5, 'name' => '小说3', 'author' => '作者3'],
['id' => 6, 'name' => '小说3', 'author' => '作者3'],
['id' => 7, 'name' => '小说3', 'author' => '作者3'],
['id' => 8, 'name' => '小说3', 'author' => '作者3'],
];
View::assign([
'arrNewsNovel' => $arrNewsNovel,
'strPageCode' => 'bookshelf'
]);
if ($boolIsMobile) {
@@ -295,7 +287,14 @@ class Novel extends BaseController
}
}
// 分类
/**
* 分类
*
* @param Request $Request
* @param [type] $intCategoryId
* @param integer $intPage
* @return void
*/
public function getNovelCategory(Request $Request, $intCategoryId = null, $intPage = 1)
{
$boolIsMobile = $Request->param('boolIsMobile');
@@ -367,7 +366,12 @@ class Novel extends BaseController
}
}
// 小说详情
/**
* 小说详情
*
* @param Request $Request
* @return void
*/
public function getNovelInfo(Request $Request)
{
$intNId = $Request->param('n_id');
@@ -424,7 +428,12 @@ class Novel extends BaseController
}
}
// 最新章节-特殊页面处理
/**
* 最新章节-特殊页面处理
*
* @param Request $Request
* @return void
*/
public function getNovelNewsChapter(Request $Request)
{
@@ -571,7 +580,14 @@ class Novel extends BaseController
}
}
// 小说章节-文章-自定义页面-列表
/**
* 小说章节-文章-自定义页面-列表
*
* @param Request $Request
* @param [type] $intCategoryId
* @param integer $intPage
* @return void
*/
public function getArticleList(Request $Request, $intCategoryId = null, $intPage = 1)
{
$boolIsMobile = $Request->param('boolIsMobile');
@@ -599,7 +615,13 @@ class Novel extends BaseController
}
}
// 小说章节-文章-自定义页面-详情
/**
* 小说章节-文章-自定义页面-详情
*
* @param Request $Request
* @param [type] $intArticleId
* @return void
*/
public function getArticleInfo(Request $Request, $intArticleId)
{
$boolIsMobile = $Request->param('boolIsMobile');

View File

@@ -428,7 +428,7 @@ class NovelModel extends MongoModel
* * total 总
* @return array
*/
public function getRankNovelOnCache(string $strSign, int $intCount = 10, int $intType = 0, $strDateType = 'daily'): array
public function getRankNovelOnCache(string $strSign, int $intCount = 10, int $intType = 0, $strDateType = 'daily', $strStatus = NULL): array
{
try {
$strKey = sprintf('%s:PC:HOME:SIX:%s:TYPE:%s', $strSign, $intType, $strDateType);
@@ -442,6 +442,11 @@ class NovelModel extends MongoModel
$arrFilter = [
'nc_type' => $strDateType,
];
if ($strStatus !== NULL) {
$arrFilter['og_novel_status'] = $strStatus;
}
if ($intType == 1) {
$arrCategory = array_values(CategoryModel::getManCategory());
$arrFilter['n_category'] = ['$in' => $arrCategory];
@@ -449,6 +454,8 @@ class NovelModel extends MongoModel
$arrCategory = array_values(CategoryModel::getWomenCategory());
$arrFilter['n_category'] = ['$in' => $arrCategory];
}
$arrOptions = [
'sort' => ['nc_clicks' => -1],
'limit' => $intCount * 3,

View File

@@ -15,7 +15,7 @@ class TemplateSeeder
't_code' => 'default',
't_path' => '/app/home/view/default/',
't_cfg_template' => [
'HOME@INDEX' => [
'HOME@GETPCINDEX' => [
'description' => '首页Title 替换模板分组ID',
'sfg_id' => 0,
],

View File

@@ -7,116 +7,13 @@ use think\template\TagLib;
class Site extends TagLib
{
protected $tags = [
'cfg' => ['attr' => 'code,encode', 'close' => 0],
'adcfg' => ['attr' => 'code,encode', 'close' => 0],
'seotdk' => ['attr' => 'code,encode,valcode', 'close' => 0],
'site' => ['attr' => 'code,encode,valcode', 'close' => 0],
'wz' => ['attr' => 'wz', 'close' => 0],
'nurl' => ['attr' => 'n_id', 'close' => 0],
'grm' => ['attr' => 'domain,code,line,diff', 'close' => 0],
];
/**
* site 标签处理函数
*
* @param array $tag
* @param string $content
* @return string
*/
public function tagSite($tag)
{
$encode = isset($tag['encode']) ? $tag['encode'] : 'false';
$valcode = isset($tag['valcode']) ? $tag['valcode'] : '';
$parse = <<<EOD
<?php
\$strCfgVal = \\app\\admin\\model\\SiteModel::getValBySiteIdByValCode("{$valcode}");
if ("{$encode}" === "true") {
echo customEntities(\$strCfgVal);
} else {
echo \$strCfgVal ;
}
?>
EOD;
return $parse;
}
/**
* cfg 标签处理函数
*
* @param array $tag
* @param string $content
* @return string
*/
public function tagCfg($tag)
{
$code = isset($tag['code']) ? $tag['code'] : '';
$encode = isset($tag['encode']) ? $tag['encode'] : 'false';
$parse = <<<EOD
<?php
\$strCfgVal = \\app\\admin\\model\\SystemConfigModel::getValByCode("{$code}");
if ("{$encode}" === "true") {
echo customEntities(\$strCfgVal);
} else {
echo \$strCfgVal;
}
?>
EOD;
return $parse;
}
/**
* adcfg标签处理函数
*
* @param array $tag
* @param string $content
* @return string
*/
public function tagAdcfg($tag)
{
$code = isset($tag['code']) ? $tag['code'] : '';
$encode = isset($tag['encode']) ? $tag['encode'] : 'false';
$parse = <<<EOD
<?php
\$strCfgVal = \\app\\admin\\model\\GuangGaoPeiZhiModel::getValByCode("{$code}");
if ("{$encode}" === "true") {
echo customEntities(\$strCfgVal);
} else {
echo \$strCfgVal;
}
?>
EOD;
return $parse;
}
/**
* seotdk 标签处理函数
*
* @param array $tag
* @param string $content
* @return string
*/
public function tagSeotdk($tag)
{
$code = isset($tag['code']) ? $tag['code'] : '';
$encode = isset($tag['encode']) ? $tag['encode'] : 'false';
$valcode = isset($tag['valcode']) ? $tag['valcode'] : '';
$parse = <<<EOD
<?php
\$strCfgVal = \\app\\admin\\model\\SeoTdkConfigModel::getValByCodeByValCode("{$code}", "{$valcode}");
if ("{$encode}" === "true") {
echo customEntities(\$strCfgVal);
} else {
var_dump( \$strCfgVal);
}
?>
EOD;
return $parse;
}