This commit is contained in:
Default
2025-03-29 22:48:43 +08:00
parent 9a834a84ea
commit 980ecedcf6
3 changed files with 222 additions and 118 deletions

View File

@@ -5,6 +5,7 @@ declare(strict_types=1);
namespace app\home\controller;
use app\home\BaseController;
use app\model\NovelModel;
use storage\StorageCore;
use think\facade\View;
use app\Request;
@@ -175,13 +176,27 @@ class Novel extends BaseController
}
}
// 男生女生频道
/**
* 男生女生频道
*
* @param Request $Request
* @return void
*/
public function getNovelChannel(Request $Request)
{
$boolIsMobile = $Request->param('boolIsMobile');
$strNovelChannel = $Request->param('strChannel'); // 区分男生/女生频道
$NovelModel = new NovelModel;
$intType = ['boys' => 1, 'girls' => 2][$strNovelChannel];
$intLifeTime = 24 * 3600;
// 模拟数据-推荐等级为9的连载的男生频道/女生频道, 随机12个小说
$strKey = sprintf('%s:PC:Novel:Channel:Hot:%s:%s', $Request->DomainModel->d_domain, $intType, 'Serialized');
$intCount = 12;
$strStuatus = '连载中';
$arrRecommendSerializationNovel = $NovelModel->getCommonNovelOnCache($strKey, $intLifeTime, $intCount, $intType, $strStuatus);
$arrRecommendSerializationNovel = [
['id' => 1, 'name' => '小说1', 'author' => '作者1'],
['id' => 2, 'name' => '小说2', 'author' => '作者2'],
@@ -197,6 +212,11 @@ class Novel extends BaseController
['id' => 12, 'name' => '小说3', 'author' => '作者3'],
];
// 模拟数据-推荐等级为9的完结的男生频道/女生频道, 随机8个小说
$strKey = sprintf('%s:PC:Novel:Channel:Hot:%s:%s', $Request->DomainModel->d_domain, $intType, 'Finish');
$intCount = 8;
$strStuatus = '完结';
$arrRecommendEndNovel = $NovelModel->getCommonNovelOnCache($strKey, $intLifeTime, $intCount, $intType, $strStuatus);
$arrRecommendEndNovel = [
['id' => 1, 'name' => '小说1', 'author' => '作者1'],
['id' => 2, 'name' => '小说2', 'author' => '作者2'],
@@ -210,6 +230,9 @@ class Novel extends BaseController
];
// 模拟数据-最近更新-随机50
$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]);
$arrNewsUpdateNovel = [
['id' => 1, 'name' => '小说1', 'author' => '作者1'],
['id' => 2, 'name' => '小说2', 'author' => '作者2'],
@@ -248,7 +271,7 @@ class Novel extends BaseController
}
// 分类
public function getNovelCategory(Request $Request,$intCategoryId = null ,$intPage = 1)
public function getNovelCategory(Request $Request, $intCategoryId = null, $intPage = 1)
{
$boolIsMobile = $Request->param('boolIsMobile');
$strChannel = $Request->param('strChannel'); // 区分男生 / 女生频道
@@ -386,7 +409,7 @@ class Novel extends BaseController
}
// 小说章节-所有章节
public function getNovelChapterAll(Request $Request,$intNovelId=null,$intPage=1,$strSort='asc')
public function getNovelChapterAll(Request $Request, $intNovelId = null, $intPage = 1, $strSort = 'asc')
{
$boolIsMobile = $Request->param('boolIsMobile');
// 模拟数据