debug
This commit is contained in:
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace app\home;
|
||||
|
||||
use app\model\ConverterMovel;
|
||||
use think\App;
|
||||
use think\exception\ValidateException;
|
||||
use think\facade\View;
|
||||
@@ -54,8 +55,32 @@ abstract class BaseController
|
||||
// View::assign('')
|
||||
}
|
||||
|
||||
// 初始化
|
||||
protected function initialize() {}
|
||||
/**
|
||||
* 初始化
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function initialize()
|
||||
{
|
||||
|
||||
$this->initSiteTKD();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 初始化网站基本信息到全局替换类里
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function initSiteTKD()
|
||||
{
|
||||
ConverterMovel::setVal([
|
||||
'strSiteTitle' => $this->request->DomainModel->d_title,
|
||||
'strSiteKeywords' => $this->request->DomainModel->d_keywords,
|
||||
'strSiteDescription' => $this->request->DomainModel->d_description,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 验证数据
|
||||
|
||||
@@ -40,18 +40,18 @@ Route::get('/pc/nvsheng-xiaoshuo', [Novel::class, 'getNovelChannel'])->append([
|
||||
*/
|
||||
Route::get('/shuku/all', [Novel::class,'getLibrary'])->append(['boolIsMobile' => true]);
|
||||
Route::get('/pc/shuku/all', [Novel::class,'getLibrary'])->append(['boolIsMobile' => false]);
|
||||
Route::get('/shuku/:strNovelChannel-:strCategory-:strStatus-:intPage', [Novel::class,'getLibrary'])
|
||||
Route::get('/shuku/:intGender-:strCategory-:strStatus-:intPage', [Novel::class,'getLibrary'])
|
||||
->pattern([
|
||||
'strNovelChannel' => '[\w]*',
|
||||
'intGender' => '\d{1}',
|
||||
'strCategory' => '[\w]*',
|
||||
'strStatus' => '[\w]*',
|
||||
'intPage' => '\d+'
|
||||
])
|
||||
->append(['boolIsMobile' => true]);
|
||||
|
||||
Route::get('/pc/shuku/:strNovelChannel-:strCategory-:strStatus-:intPage', [Novel::class,'getLibrary'])
|
||||
Route::get('/pc/shuku/:intGender-:strCategory-:strStatus-:intPage', [Novel::class,'getLibrary'])
|
||||
->pattern([
|
||||
'strNovelChannel' => '[\w]*',
|
||||
'intGender' => '\d{1}',
|
||||
'strCategory' => '[\w]*',
|
||||
'strStatus' => '[\w]*',
|
||||
'intPage' => '\d+'
|
||||
|
||||
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace app\home\controller;
|
||||
|
||||
use app\home\BaseController;
|
||||
use app\model\ConverterMovel;
|
||||
use app\model\NovelModel;
|
||||
use storage\StorageCore;
|
||||
use think\facade\View;
|
||||
@@ -132,28 +133,28 @@ class Index extends BaseController
|
||||
|
||||
// 推荐等级为9的完结的 随机12个小说
|
||||
$arrRecommendEndNovel = $NovelModel->getFinishedNovelOnCache($Request->DomainModel->d_domain, 12);
|
||||
|
||||
|
||||
// 男生频道,最新的 随机5个小说
|
||||
$arrBoyNewsNovel = $NovelModel->getSexNovelOnCache($Request->DomainModel->d_domain, 5, 1);
|
||||
|
||||
|
||||
// 男生频道,周排行榜 随机10个小说
|
||||
$arrBoyWeekRankNovel = $NovelModel->getRankNovelOnCache($Request->DomainModel->d_domain, 5, 1, 'weekly');
|
||||
|
||||
// 男生频道,月排行榜 随机10个小说
|
||||
$arrBoyMoonRankNovel = $NovelModel->getRankNovelOnCache($Request->DomainModel->d_domain, 5, 1, 'monthly');
|
||||
|
||||
|
||||
// 男生频道,总排行榜 随机10个小说
|
||||
$arrBoyTotalRankNovel = $NovelModel->getRankNovelOnCache($Request->DomainModel->d_domain, 5, 1, 'total');
|
||||
|
||||
// 女生频道,最新的 随机5个小说
|
||||
$arrGirlNewsNovel = $NovelModel->getSexNovelOnCache($Request->DomainModel->d_domain, 5, 2);
|
||||
|
||||
|
||||
// 女生频道,周排行榜 随机10个小说
|
||||
$arrGirlWeekRankNovel = $NovelModel->getRankNovelOnCache($Request->DomainModel->d_domain, 5, 2, 'weekly');
|
||||
|
||||
// 女生频道,月排行榜 随机10个小说
|
||||
$arrGirlMoonRankNovel = $NovelModel->getRankNovelOnCache($Request->DomainModel->d_domain, 5, 2, 'monthly');
|
||||
|
||||
|
||||
// 女生频道,总排行榜 随机10个小说
|
||||
$arrBGirlTotalRankNovel = $NovelModel->getRankNovelOnCache($Request->DomainModel->d_domain, 5, 2, 'total');
|
||||
|
||||
@@ -176,11 +177,18 @@ class Index extends BaseController
|
||||
'strPageCode' => 'home'
|
||||
]);
|
||||
|
||||
|
||||
$strTitle = '最新小说网-{strSiteTitle}-{strSiteKeywords}';
|
||||
|
||||
$strTitle = ConverterMovel::convert($strTitle);
|
||||
|
||||
echo $strTitle;exit;
|
||||
|
||||
|
||||
if ($boolIsMobile) {
|
||||
return View::fetch();
|
||||
} else {
|
||||
return View::fetch('pc/index');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace app\home\controller;
|
||||
|
||||
use app\home\BaseController;
|
||||
use app\model\ConverterMovel;
|
||||
use app\model\NovelModel;
|
||||
use storage\StorageCore;
|
||||
use think\facade\View;
|
||||
@@ -124,16 +125,34 @@ class Novel extends BaseController
|
||||
* 书库
|
||||
*
|
||||
* @param Request $Request
|
||||
* @param [type] $strNovelChannel 男生/女生 -拼音
|
||||
* @param [type] $strCategory 分类 -拼音
|
||||
* @param [type] $strStatus 连载/完结 -拼音
|
||||
* @param string $strNovelChannel 男生/女生 -拼音
|
||||
* @param string $strCategory 分类 -拼音
|
||||
* @param string $strStatus 连载/完结 -拼音
|
||||
* @param integer $intPage 分页
|
||||
* @return void
|
||||
*/
|
||||
public function getLibrary(Request $Request, $strNovelChannel = 'all', $strCategory = 'all', $strStatus = 'all',$intPage = 1)
|
||||
public function getLibrary(Request $Request) //, $strNovelChannel = 'all', $strCategory = 'all', $strStatus = 'all', $intPage = 1)
|
||||
{
|
||||
$boolIsMobile = $Request->param('boolIsMobile');
|
||||
|
||||
$intGender = (int)$Request->param('intGender',0);
|
||||
$strCategory = (string)$Request->param('strCategory');
|
||||
$strStatus = (string)$Request->param('strStatus');
|
||||
$intPage = (int)$Request->param('intPage');
|
||||
$intLimit = 20;
|
||||
$intLifeTime = 24 * 3600;
|
||||
|
||||
$NovelModel = new NovelModel;
|
||||
|
||||
$strKey = sprintf("Novel:Library:%s:%s:%s:%s", $intGender, $strCategory, $strStatus, $intPage);
|
||||
|
||||
// var_dump($intType);exit;
|
||||
$arrPage = $NovelModel->getCommonNovelPageOnCache($strKey, $intPage, $intLimit, $intLifeTime, $intGender, $strStatus);
|
||||
|
||||
// echo '<pre>';
|
||||
// print_r($arrPage);
|
||||
// exit;
|
||||
|
||||
// 模拟数据
|
||||
$arrNovel = [
|
||||
['n_id' => 1, 'name' => '小说1', 'author' => '作者1'],
|
||||
@@ -149,7 +168,7 @@ class Novel extends BaseController
|
||||
View::assign([
|
||||
'arrNovel' => $arrNovel,
|
||||
'strPageCode' => 'library',
|
||||
'strNovelChannel' => $strNovelChannel,
|
||||
'intGender' => $intGender,
|
||||
'strCategory' => $strCategory,
|
||||
'strStatus' => $strStatus,
|
||||
'intPage' => $intPage,
|
||||
@@ -210,7 +229,7 @@ class Novel extends BaseController
|
||||
$strStuatus = '连载中';
|
||||
|
||||
$arrRecommendSerializationNovel = $NovelModel->getCommonNovelOnCache($strKey, $intLifeTime, $intCount, $intType, $strStuatus);
|
||||
|
||||
|
||||
// 推荐等级为9的,完结的,男生频道/女生频道, 随机8个小说
|
||||
$strKey = sprintf('%s:PC:Novel:Channel:Hot:%s:%s', $Request->DomainModel->d_domain, $intType, 'Finish');
|
||||
$intCount = 8;
|
||||
@@ -222,7 +241,7 @@ class Novel extends BaseController
|
||||
$strKey = sprintf('%s:PC:Novel:Channel:Latest:%s', $Request->DomainModel->d_domain, $intType);
|
||||
$intCount = 20;
|
||||
$arrNewsUpdateNovel = $NovelModel->getCommonNovelOnCache($strKey, $intLifeTime, $intCount, $intType, NULL, ['og_novel_update_time' => -1]);
|
||||
|
||||
|
||||
View::assign([
|
||||
'arrRecommendSerializationNovel' => $arrRecommendSerializationNovel,
|
||||
'arrRecommendEndNovel' => $arrRecommendEndNovel,
|
||||
@@ -314,10 +333,14 @@ class Novel extends BaseController
|
||||
{
|
||||
$intNId = $Request->param('n_id');
|
||||
|
||||
|
||||
|
||||
$boolIsMobile = $Request->param('boolIsMobile');
|
||||
|
||||
|
||||
$strNovel = '斗罗大陆';
|
||||
|
||||
ConverterMovel::setVal("strNovelName",$strNovel);
|
||||
|
||||
|
||||
// 模拟数据-随机推荐数据10条
|
||||
$arrRecommendNovel = [
|
||||
['id' => 1, 'name' => '小说1', 'author' => '作者1'],
|
||||
@@ -336,6 +359,14 @@ class Novel extends BaseController
|
||||
// 最新要点->取新意章节, 随机提取一部分内容 大概150字数
|
||||
|
||||
|
||||
|
||||
|
||||
// $strTitle = '小说详情-{strNovelName}-xxxxx';
|
||||
|
||||
// $strTitle = ConverterMovel::convert($strTitle);
|
||||
|
||||
// echo $strTitle;exit;
|
||||
|
||||
View::assign([
|
||||
'arrRecommendNovel' => $arrRecommendNovel,
|
||||
'strPageCode' => 'boy'
|
||||
@@ -351,7 +382,7 @@ class Novel extends BaseController
|
||||
public function getNovelNewsChapter(Request $Request)
|
||||
{
|
||||
|
||||
|
||||
|
||||
$intNId = $Request->param('n_id');
|
||||
|
||||
|
||||
@@ -385,7 +416,7 @@ class Novel extends BaseController
|
||||
return View::fetch('pc/getNovelChapter');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 小说章节
|
||||
|
||||
@@ -28,25 +28,25 @@
|
||||
<div class="optCl" mod="search_channel">
|
||||
<span class="optTit">所属频道</span>
|
||||
<ul>
|
||||
<li><a class="on" href="/pc/shuku/all-{$strCategory}-{$strStatus}-1.html" btn="search_category">全部</a></li>
|
||||
<li><a href="/pc/shuku/nansheng-{$strCategory}-{$strStatus}-1.html" btn="search_category">男生</a></li>
|
||||
<li><a href="/pc/shuku/nvsheng-{$strCategory}-{$strStatus}-1.html" btn="search_category">女生</a></li>
|
||||
<li><a class="on" href="/pc/shuku/{$intGender}-{$strCategory}-{$strStatus}-{$intPage}.html" btn="search_category">全部</a></li>
|
||||
<li><a href="/pc/shuku/{$intGender}-{$strCategory}-{$strStatus}-{$intPage}" btn="search_category">男生</a></li>
|
||||
<li><a href="/pc/shuku/{$intGender}-{$strCategory}-{$strStatus}-{$intPage}" btn="search_category">女生</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="optCl" mod="search_channel">
|
||||
<span class="optTit">所属分类</span>
|
||||
<ul>
|
||||
<li><a class="on" href="/pc/shuku/{$strNovelChannel}-all-{$strStatus}-1.html" btn="search_category">全部</a></li>
|
||||
<li><a href="/pc/shuku/{$strNovelChannel}-dushixiuxian-{$strStatus}-1.html" btn="search_category">都市修仙</a></li>
|
||||
<li><a href="/pc/shuku/{$strNovelChannel}-xuanhuanxiuzhen-{$strStatus}-1.html" btn="search_category">玄幻修真</a></li>
|
||||
<li><a class="on" href="/pc/shuku/{$intGender}-{$strCategory}-{$strStatus}-{$intPage}" btn="search_category">全部</a></li>
|
||||
<li><a href="/pc/shuku/{$intGender}-{$strCategory}-{$strStatus}-{$intPage}" btn="search_category">都市修仙</a></li>
|
||||
<li><a href="/pc/shuku/{$intGender}-{$strCategory}-{$strStatus}-{$intPage}" btn="search_category">玄幻修真</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="optCl">
|
||||
<span class="optTit">是否完结</span>
|
||||
<ul>
|
||||
<li><a class="on" href="/pc/shuku/{$strNovelChannel}-{$strCategory}-all-1.html" btn="search_category">全部</a></li>
|
||||
<li><a href="/pc/shuku/{$strNovelChannel}-{$strCategory}-lianzai-1.html" btn="search_category">连载</a></li>
|
||||
<li><a href="/pc/shuku/{$strNovelChannel}-{$strCategory}-wanben-1.html" btn="search_category">完本</a></li>
|
||||
<li><a class="on" href="/pc/shuku/{$intGender}-{$strCategory}-{$strStatus}-{$intPage}" btn="search_category">全部</a></li>
|
||||
<li><a href="/pc/shuku/{$intGender}-{$strCategory}-{$strStatus}-{$intPage}" btn="search_category">连载</a></li>
|
||||
<li><a href="/pc/shuku/{$intGender}-{$strCategory}-{$strStatus}-{$intPage}" btn="search_category">完本</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@@ -65,17 +65,17 @@
|
||||
<ul class="pagination">
|
||||
<li class="disabled"><span>«</span></li>
|
||||
<li class="active"><span>1</span></li>
|
||||
<li><a href="/pc/{$strNovelChannel}-{$strCategory}-{$strStatus}-2">2</a></li>
|
||||
<li><a href="/pc/{$strNovelChannel}-{$strCategory}-{$strStatus}-3">3</a></li>
|
||||
<li><a href="/pc/{$strNovelChannel}-{$strCategory}-{$strStatus}-4">4</a></li>
|
||||
<li><a href="/pc/{$strNovelChannel}-{$strCategory}-{$strStatus}-5">5</a></li>
|
||||
<li><a href="/pc/{$strNovelChannel}-{$strCategory}-{$strStatus}-6">6</a></li>
|
||||
<li><a href="/pc/{$strNovelChannel}-{$strCategory}-{$strStatus}-7">7</a></li>
|
||||
<li><a href="/pc/{$strNovelChannel}-{$strCategory}-{$strStatus}-8">8</a></li>
|
||||
<li><a href="/pc/{$intGender}-{$strCategory}-{$strStatus}-2">2</a></li>
|
||||
<li><a href="/pc/{$intGender}-{$strCategory}-{$strStatus}-3">3</a></li>
|
||||
<li><a href="/pc/{$intGender}-{$strCategory}-{$strStatus}-4">4</a></li>
|
||||
<li><a href="/pc/{$intGender}-{$strCategory}-{$strStatus}-5">5</a></li>
|
||||
<li><a href="/pc/{$intGender}-{$strCategory}-{$strStatus}-6">6</a></li>
|
||||
<li><a href="/pc/{$intGender}-{$strCategory}-{$strStatus}-7">7</a></li>
|
||||
<li><a href="/pc/{$intGender}-{$strCategory}-{$strStatus}-8">8</a></li>
|
||||
<li class="disabled"><span>...</span></li>
|
||||
<li><a href="/pc/{$strNovelChannel}-{$strCategory}-{$strStatus}-33">33</a></li>
|
||||
<li><a href="/pc/{$strNovelChannel}-{$strCategory}-{$strStatus}-34">34</a></li>
|
||||
<li><a href="/pc/{$strNovelChannel}-{$strCategory}-{$strStatus}-2">»</a></li>
|
||||
<li><a href="/pc/{$intGender}-{$strCategory}-{$strStatus}-33">33</a></li>
|
||||
<li><a href="/pc/{$intGender}-{$strCategory}-{$strStatus}-34">34</a></li>
|
||||
<li><a href="/pc/{$intGender}-{$strCategory}-{$strStatus}-2">»</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<!--页码切换 结束-->
|
||||
|
||||
Reference in New Issue
Block a user