This commit is contained in:
make
2025-04-02 17:22:15 +08:00
parent 40de78c605
commit 5df962b350
15 changed files with 461 additions and 54 deletions

View File

@@ -313,6 +313,85 @@ class Novel extends BaseController
// }
// }
/**
* 小说详情-kan
*
* @param Request $Request
* @return void
*/
public function getKanNovelInfo(Request $Request)
{
$intNId = $Request->param('n_id');
$boolIsMobile = $Request->param('boolIsMobile');
$NovelModel = new NovelModel;
// 小说详情
$arrNovel = $NovelModel->getNovelInfo($intNId);
// 分品拼音
$arrNovel['category_pinyin'] = CategoryModel::getPinYinByZh($arrNovel['og_novel_category']);
// 最后章节
$ChapterModel = new ChapterModel;
$arrLatestChapter = $ChapterModel->getLatestChapter($intNId);
// 要点
$strFocus = strip_tags($arrLatestChapter['content']);
$intCount = mb_strlen($strFocus);
if ($intCount > 300) {
$intPos = mt_rand(0, $intCount - 300);
$strFocus = mb_substr($strFocus, $intPos, 300);
}
// 最近五个章节
$arrChapter = $ChapterModel->getChapterAll([
'n_id' => $intNId,
'c_page' => 0,
], 10, ['c_sort_num' => -1]);
// 点击数
$NovelClicksModel = new NovelClicksModel;
$arrNovelClicks = $NovelClicksModel->getStats($intNId);
// 推荐小说
$arrRelateveNId = array_column($arrNovel['n_related_novel'], 'n_id');
$arrRelateveNovel = $NovelModel->getNovelAll([
'$in' => $arrRelateveNId,
], 10);
// echo '<pre>';
// var_dump($arrNovel);exit;
// $strNovel = '斗罗大陆';
// ConverterMovel::setVal("strNovelName", $strNovel);
// $strTitle = $Request->DomainModel->getFomartSubject(getFomartSubjectKey(__METHOD__));
// $strTitle = ConverterMovel::convert($strTitle);
View::assign([
'arrRelateveNovel' => $arrRelateveNovel,
'arrNovel' => $arrNovel,
'arrChapter' => $arrChapter,
'arrNovelClicks' => $arrNovelClicks,
'strFocus' => $strFocus,
'strPageCode' => 'boy',
// 'strTitle' => $strTitle,
]);
if ($boolIsMobile) {
return View::fetch();
} else {
return View::fetch('pc/getKanNovelInfo');
}
}
/**
* 小说详情
*
@@ -363,7 +442,7 @@ class Novel extends BaseController
'$in' => $arrRelateveNId,
], 10);
// echo '<pre>';
// var_dump($arrLatestChapter);exit;
// var_dump($arrNovel);exit;
$strNovel = '斗罗大陆';
@@ -473,8 +552,13 @@ class Novel extends BaseController
$arrPreChapter = $ChapterModel->getPreChapter($arrChapter['n_id'], $arrChapter['c_sort_num'], $arrChapter['c_page']);
$arrNextChapter = $ChapterModel->getNextChapter($arrChapter['n_id'], $arrChapter['c_sort_num'], $arrChapter['c_page']);
// 缺少数据
// 分类:男生和女生所对应的分类,看导航展示
// 这个小说的 分类拼音
// 这个小说 是属于 女生还是男生
// echo '<pre>';
// var_dump($arrChapter);
// var_dump($arrNovel);
View::assign([
'arrNovel' => $arrNovel,
@@ -505,20 +589,27 @@ class Novel extends BaseController
public function getNovelChapterAll(Request $Request, $intNovelId = null, $intPage = 1, $strOrder = 'zheng')
{
$boolIsMobile = $Request->param('boolIsMobile');
// 模拟数据
$arrNovelChapterAll = [
['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;
$intNId = $intNovelId;
$arrNovel = $NovelModel->getNovelInfo($intNId);
// 章节目录
$arrChapter = [
['c_sort_num' => 1, 'created_at' => '第1章', 'author' => '作者1'],
['c_sort_num' => 1, 'created_at' => '第2章', 'author' => '作者1'],
['c_sort_num' => 1, 'created_at' => '第3章', 'author' => '作者1'],
['c_sort_num' => 1, 'created_at' => '第4章', 'author' => '作者1'],
['c_sort_num' => 1, 'created_at' => '第5章', 'author' => '作者1'],
['c_sort_num' => 1, 'created_at' => '第6章', 'author' => '作者1'],
];
View::assign([
'arrNovelChapterAll' => $arrNovelChapterAll,
'arrNovel' => $arrNovel,
'arrChapter' => $arrChapter,
'intNovelId' => $intNovelId,
'intPage' => $intPage,
'strOrder' => $strOrder,