debug
This commit is contained in:
@@ -13,6 +13,7 @@ use app\model\NovelModel;
|
|||||||
use storage\StorageCore;
|
use storage\StorageCore;
|
||||||
use think\facade\View;
|
use think\facade\View;
|
||||||
use app\Request;
|
use app\Request;
|
||||||
|
use app\task\crawler\zw630\page\ChapterPage;
|
||||||
use template\page\CusteomPage02;
|
use template\page\CusteomPage02;
|
||||||
|
|
||||||
class Novel extends BaseController
|
class Novel extends BaseController
|
||||||
@@ -329,10 +330,22 @@ class Novel extends BaseController
|
|||||||
// 小说详情
|
// 小说详情
|
||||||
$arrNovel = $NovelModel->getNovelInfo($intNId);
|
$arrNovel = $NovelModel->getNovelInfo($intNId);
|
||||||
|
|
||||||
|
// 分品拼音
|
||||||
|
$arrNovel['category_pinyin'] = CategoryModel::getPinYinByZh($arrNovel['og_novel_category']);
|
||||||
|
|
||||||
|
|
||||||
// 最后章节
|
// 最后章节
|
||||||
$ChapterModel = new ChapterModel;
|
$ChapterModel = new ChapterModel;
|
||||||
$arrLatestChapter = $ChapterModel->getLatestChapter($intNId);
|
$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([
|
$arrChapter = $ChapterModel->getChapterAll([
|
||||||
'n_id' => $intNId,
|
'n_id' => $intNId,
|
||||||
@@ -365,7 +378,7 @@ class Novel extends BaseController
|
|||||||
'arrNovel' => $arrNovel,
|
'arrNovel' => $arrNovel,
|
||||||
'arrChapter' => $arrChapter,
|
'arrChapter' => $arrChapter,
|
||||||
'arrNovelClicks' => $arrNovelClicks,
|
'arrNovelClicks' => $arrNovelClicks,
|
||||||
'arrLatestChapter' => $arrLatestChapter,
|
'strFocus' => $strFocus,
|
||||||
'strPageCode' => 'boy',
|
'strPageCode' => 'boy',
|
||||||
'strTitle' => $strTitle,
|
'strTitle' => $strTitle,
|
||||||
]);
|
]);
|
||||||
@@ -385,10 +398,22 @@ class Novel extends BaseController
|
|||||||
public function getNovelNewsChapter(Request $Request)
|
public function getNovelNewsChapter(Request $Request)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
$boolIsMobile = $Request->param('boolIsMobile');
|
||||||
|
|
||||||
$intNId = $Request->param('n_id');
|
$intNId = $Request->param('n_id');
|
||||||
|
|
||||||
|
// 小说详情
|
||||||
|
$NovelModel = new NovelModel;
|
||||||
|
$arrNovel = $NovelModel->getNovelInfo($intNId);
|
||||||
|
|
||||||
|
// 最新章节
|
||||||
|
$ChapterModel = new ChapterModel;
|
||||||
|
$arrChapter = $ChapterModel->getLatestChapter($intNId);
|
||||||
|
|
||||||
|
// 上一章节和下一章节
|
||||||
|
$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']);
|
||||||
|
|
||||||
$boolIsMobile = $Request->param('boolIsMobile');
|
|
||||||
|
|
||||||
// 模拟数据-随机推荐数据10条
|
// 模拟数据-随机推荐数据10条
|
||||||
$arrNewsNovel = [
|
$arrNewsNovel = [
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
<meta itemprop="position" content="1" />
|
<meta itemprop="position" content="1" />
|
||||||
</li>
|
</li>
|
||||||
<li class="breadcrumb-item" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
|
<li class="breadcrumb-item" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
|
||||||
<a href="/pc/shuku/all" itemprop="item">
|
<a href="/pc/shuku/all/{$arrNovel.category_pinyin}/all/page1" itemprop="item">
|
||||||
<span itemprop="name">{$arrNovel.og_novel_category}</span>
|
<span itemprop="name">{$arrNovel.og_novel_category}</span>
|
||||||
</a>
|
</a>
|
||||||
<meta itemprop="position" content="2" />
|
<meta itemprop="position" content="2" />
|
||||||
@@ -69,7 +69,7 @@
|
|||||||
<p class="jianjie">最新要点</p>
|
<p class="jianjie">最新要点</p>
|
||||||
<div class="c03_box">
|
<div class="c03_box">
|
||||||
<p class="jj_con" id="book_desc2" >
|
<p class="jj_con" id="book_desc2" >
|
||||||
{$arrLatestChapter.content}</p>
|
{$strFocus}</p>
|
||||||
<span class="zk_btn" style="">展开<s></s></span>
|
<span class="zk_btn" style="">展开<s></s></span>
|
||||||
<span class="sq_btn" style="display: none;">收起<s></s></span>
|
<span class="sq_btn" style="display: none;">收起<s></s></span>
|
||||||
</div>
|
</div>
|
||||||
@@ -91,7 +91,7 @@
|
|||||||
<div class="inf02">
|
<div class="inf02">
|
||||||
<h4>小说信息</h4>
|
<h4>小说信息</h4>
|
||||||
<p>类别:
|
<p>类别:
|
||||||
<a href='/pc{site:nurl n_id="$arrNovel[n_id]" n_py="$arrNovel[og_novel_pin_yin]" /}'
|
<a href='/pc/shuku/all/{$arrNovel.category_pinyin}/all/page1'
|
||||||
title="{$arrNovel.og_novel_category}" target="_blank">
|
title="{$arrNovel.og_novel_category}" target="_blank">
|
||||||
{$arrNovel.og_novel_category}
|
{$arrNovel.og_novel_category}
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -70,4 +70,10 @@ class CategoryModel extends MongoModel
|
|||||||
{
|
{
|
||||||
return self::$arrWomen;
|
return self::$arrWomen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static public function getPinYinByZh(string $strZh)
|
||||||
|
{
|
||||||
|
$intKey = array_search($strZh, self::$arrCategory);
|
||||||
|
return self::$arrCategoryPinYin[$intKey];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,7 +58,6 @@ class ChapterModel extends MongoModel
|
|||||||
$arrChapter['content'] = StorageCore::getInstance()->read($arrChapter['c_content_path']);
|
$arrChapter['content'] = StorageCore::getInstance()->read($arrChapter['c_content_path']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return $arrChapter;
|
return $arrChapter;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,8 +77,6 @@ class ChapterModel extends MongoModel
|
|||||||
|
|
||||||
$arrOptions['limit'] = $intCount;
|
$arrOptions['limit'] = $intCount;
|
||||||
|
|
||||||
$arrFilter = [];
|
|
||||||
|
|
||||||
$Cursor = $this->getCol()->find($arrFilter, $arrOptions);
|
$Cursor = $this->getCol()->find($arrFilter, $arrOptions);
|
||||||
|
|
||||||
$arrResult = iterator_to_array($Cursor);
|
$arrResult = iterator_to_array($Cursor);
|
||||||
@@ -95,4 +92,74 @@ class ChapterModel extends MongoModel
|
|||||||
|
|
||||||
return $arrResult;
|
return $arrResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Undocumented function
|
||||||
|
*
|
||||||
|
* @param integer $intNId
|
||||||
|
* @param integer $intCSortNum
|
||||||
|
* @param integer $intCPage
|
||||||
|
* @return null|array
|
||||||
|
*/
|
||||||
|
public function getPreChapter(int $intNId, int $intCSortNum, int $intCPage): null|array
|
||||||
|
{
|
||||||
|
$arrFilter = [
|
||||||
|
'$and' => [
|
||||||
|
[
|
||||||
|
'$or' => [
|
||||||
|
['c_sort_num' => ['$lt' => $intCSortNum]],
|
||||||
|
[
|
||||||
|
'$and' => [
|
||||||
|
['c_sort_num' => ['$eq' => $intCSortNum]],
|
||||||
|
['c_page' => ['$lt' => $intCPage]]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
],
|
||||||
|
['n_id' => $intNId]
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
$arrSort = [
|
||||||
|
'c_sort_num' => -1,
|
||||||
|
'c_page' => -1,
|
||||||
|
];
|
||||||
|
return $this->getChapterAll($arrFilter, 1, $arrSort);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Undocumented function
|
||||||
|
*
|
||||||
|
* @param integer $intNId
|
||||||
|
* @param integer $intCSortNum
|
||||||
|
* @param integer $intCPage
|
||||||
|
* @return null|array
|
||||||
|
*/
|
||||||
|
public function getNextChapter(int $intNId, int $intCSortNum, int $intCPage): null|array
|
||||||
|
{
|
||||||
|
$arrFilter = [
|
||||||
|
'$and' => [
|
||||||
|
[
|
||||||
|
'$or' => [
|
||||||
|
['c_sort_num' => ['$gt' => $intCSortNum]],
|
||||||
|
[
|
||||||
|
'$and' => [
|
||||||
|
['c_sort_num' => ['$eq' => $intCSortNum]],
|
||||||
|
['c_page' => ['$gt' => $intCPage]]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
],
|
||||||
|
['n_id' => $intNId]
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
$arrSort = [
|
||||||
|
'c_sort_num' => 1,
|
||||||
|
'c_page' => 1,
|
||||||
|
];
|
||||||
|
return $this->getChapterAll($arrFilter, 1, $arrSort);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -102,12 +102,13 @@ class NovelModel extends MongoModel
|
|||||||
foreach ($arrResult as &$arrItem) {
|
foreach ($arrResult as &$arrItem) {
|
||||||
|
|
||||||
applyToKeys($arrItem, ['created_at', 'updated_at'], 'formatMongoDate');
|
applyToKeys($arrItem, ['created_at', 'updated_at'], 'formatMongoDate');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $arrResult;
|
return $arrResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Undocumented function
|
* Undocumented function
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user