This commit is contained in:
Default
2025-03-31 16:25:12 +08:00
parent 7fc4233066
commit 6a11a33e27
10 changed files with 292 additions and 44 deletions

View File

@@ -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');
}
}
}

View File

@@ -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');
}
}
/**
* 小说章节