diff --git a/code/app/home/controller/Index.php b/code/app/home/controller/Index.php index 7ea7299..fc524d4 100644 --- a/code/app/home/controller/Index.php +++ b/code/app/home/controller/Index.php @@ -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, diff --git a/code/app/home/controller/Novel.php b/code/app/home/controller/Novel.php index aab4673..288fe52 100644 --- a/code/app/home/controller/Novel.php +++ b/code/app/home/controller/Novel.php @@ -15,13 +15,13 @@ 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'); diff --git a/code/app/home/view/kuangyu/Public/novelListH.html b/code/app/home/view/kuangyu/Public/novelListH.html index 43f0067..0a5d5ee 100644 --- a/code/app/home/view/kuangyu/Public/novelListH.html +++ b/code/app/home/view/kuangyu/Public/novelListH.html @@ -1,19 +1,15 @@
  • - 我真是一条龙 - 我真是一条龙 -

    - 我的父亲告诉我,在我出生那一年,天上金光闪耀,隐隐约约中,好像能看到云朵里有条龙在盘旋,紧接着,一道金光照入我们的村子,我便出生了……为寻答案来人间,天龙问世扰乾坤。 - 无情无义闹天下,千军万马赴黄泉。 - 本站提示:各位书友要是觉得《我真是一条龙》还不错的话请不要忘记向您QQ群和微博里的朋友推荐哦! -

    + {$Novel.og_novel_book_name ?? ''} + {$Novel.og_novel_book_name ?? ''} +

    {$Novel.og_description ?? ''}

    - 作者:兔子很淡定 + 作者:{$Novel.og_novel_author ?? ''} - 耽美百合 - - 已完结 + {$Novel->og_novel_category ?? ''} + {$Novel->og_novel_status ?? ''}

  • diff --git a/code/app/home/view/kuangyu/Public/novelListS.html b/code/app/home/view/kuangyu/Public/novelListS.html index 6588bf0..f11cfe5 100644 --- a/code/app/home/view/kuangyu/Public/novelListS.html +++ b/code/app/home/view/kuangyu/Public/novelListS.html @@ -1,10 +1,10 @@
  • - + 落魄千金美食发家日常 - 落魄千金美食发家日常 + data-src="{$Novel.n_cover_path ?? ''}" alt="{$Novel.og_novel_book_name ?? ''}" /> + {$Novel.og_novel_book_name ?? ''} - 作者:鱼昆子 + 作者:{$Novel.og_novel_author ?? ''} -
  • \ No newline at end of file + \ No newline at end of file diff --git a/code/app/model/NovelModel.php b/code/app/model/NovelModel.php index 49334fb..4dc9fd2 100644 --- a/code/app/model/NovelModel.php +++ b/code/app/model/NovelModel.php @@ -111,10 +111,11 @@ class NovelModel extends MongoModel 'og_description' => 1, 'og_novel_latest_chapter_name' => 1, 'og_novel_update_time' => 1, + 'og_novel_status' => 1, ], ]; - + $Cursor = $this->getCol()->find($arrFilter, $arrOptions); $intTotal = $this->getCol()->countDocuments($arrFilter); @@ -269,6 +270,7 @@ class NovelModel extends MongoModel 'n_novel_author' => 1, 'og_novel_category' => 1, 'og_description' => 1, + 'og_novel_status' => 1, ], ]; @@ -325,6 +327,7 @@ class NovelModel extends MongoModel 'og_novel_author' => 1, 'og_novel_category' => 1, 'og_description' => 1, + 'og_novel_status' => 1, ], ]; @@ -393,6 +396,7 @@ class NovelModel extends MongoModel 'og_description' => 1, 'og_novel_update_time' => 1, 'og_novel_latest_chapter_name' => 1, + 'og_novel_status' => 1, ], ]; @@ -429,7 +433,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); @@ -443,6 +447,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]; @@ -450,6 +459,8 @@ class NovelModel extends MongoModel $arrCategory = array_values(CategoryModel::getWomenCategory()); $arrFilter['n_category'] = ['$in' => $arrCategory]; } + + $arrOptions = [ 'sort' => ['nc_clicks' => -1], 'limit' => $intCount * 3, @@ -478,6 +489,7 @@ class NovelModel extends MongoModel 'n_novel_author' => 1, 'og_novel_category' => 1, 'og_description' => 1, + 'og_novel_status' => 1, ], ] ); diff --git a/code/database/seeders/TemplateSeeder.php b/code/database/seeders/TemplateSeeder.php index bb22c4b..404d409 100644 --- a/code/database/seeders/TemplateSeeder.php +++ b/code/database/seeders/TemplateSeeder.php @@ -15,7 +15,7 @@ class TemplateSeeder 't_code' => 'default', 't_path' => '/app/home/view/default/', 't_cfg_template' => [ - 'INDEX@GETPCINDEX' => [ + 'HOME@GETPCINDEX' => [ 'description' => '首页Title 替换模板分组ID', 'sfg_id' => 0, ], diff --git a/code/extend/template/taglib/Site.php b/code/extend/template/taglib/Site.php index 24f673d..5177a22 100644 --- a/code/extend/template/taglib/Site.php +++ b/code/extend/template/taglib/Site.php @@ -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; - 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; - 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; - 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; - return $parse; - } +