本次更新

1.domain 增加了几个字段,已经 backup,
2.视图模板,替换模板分组,替换模板 数据增加了seed 播种
3. 标记了TODO
This commit is contained in:
make
2025-04-05 20:41:47 +08:00
parent 25bf602048
commit 9945b6b137
52 changed files with 2675 additions and 255 deletions

View File

@@ -42,6 +42,21 @@ class Index extends BaseController
$strStatus = '已完结';
$arrEndNovelRankNovel = $NovelModel->getRankNovelOnCache($strKey, 10, 0, 'total',$strStatus);
// Title 模板
ConverterMovel::setVal([
'strIndexTitle' => $this->request->DomainModel->d_index_title,
'strIndexKeywords' => $this->request->DomainModel->d_index_keywords,
'strIndexDescription' => $this->request->DomainModel->d_index_description,
]);
// $strTitle = $Request->DomainModel->getFomartSubject(getFomartSubjectKey(__METHOD__));
$strTitleTemplate = $Request->DomainModel->getFomartSubject(getFomartSubjectKey(__METHOD__).'@TITLE');
$strKeywordsTemplate = $Request->DomainModel->getFomartSubject(getFomartSubjectKey(__METHOD__).'@KEYWORDS');
$strDescriptionTemplate = $Request->DomainModel->getFomartSubject(getFomartSubjectKey(__METHOD__).'@DESCRIPTION');
$strTitle = ConverterMovel::convert($strTitleTemplate);
$strKeywords = ConverterMovel::convert($strKeywordsTemplate);
$strDescription = ConverterMovel::convert($strDescriptionTemplate);
View::assign([
'arrRecommendNovel' => $arrRecommendNovel,
@@ -50,7 +65,10 @@ class Index extends BaseController
'arrWeekRankNovel' => $arrWeekRankNovel,
'arrMoonRankNovel' => $arrMoonRankNovel,
'arrEndNovelRankNovel' => $arrEndNovelRankNovel,
'strPageCode' => 'home'
'strPageCode' => 'home',
'strTitle' => $strTitle,
'strKeywords' => $strKeywords,
'strDescription' => $strDescription,
]);
if ($boolIsMobile) {
@@ -109,10 +127,20 @@ class Index extends BaseController
// 最近更新-随机50
$arrNewsUpdateNovel = $NovelModel->getSexNovelOnCache($Request->DomainModel->d_domain, 50);
$strTitle = $Request->DomainModel->getFomartSubject(getFomartSubjectKey(__METHOD__));
$strTitle = ConverterMovel::convert($strTitle);
// Title 模板
ConverterMovel::setVal([
'strIndexTitle' => $this->request->DomainModel->d_index_title,
'strIndexKeywords' => $this->request->DomainModel->d_index_keywords,
'strIndexDescription' => $this->request->DomainModel->d_index_description,
]);
// $strTitle = $Request->DomainModel->getFomartSubject(getFomartSubjectKey(__METHOD__));
$strTitleTemplate = $Request->DomainModel->getFomartSubject('INDEX@INDEX@TITLE');
$strKeywordsTemplate = $Request->DomainModel->getFomartSubject('INDEX@INDEX@KEYWORDS');
$strDescriptionTemplate = $Request->DomainModel->getFomartSubject('INDEX@INDEX@DESCRIPTION');
$strTitle = ConverterMovel::convert($strTitleTemplate);
$strKeywords = ConverterMovel::convert($strKeywordsTemplate);
$strDescription = ConverterMovel::convert($strDescriptionTemplate);
View::assign([
'arrNewsUpdateNovel' => $arrNewsUpdateNovel,
@@ -129,6 +157,8 @@ class Index extends BaseController
'arrAdBanner' => [],
'strPageCode' => 'home',
'strTitle' => $strTitle,
'strKeywords' => $strKeywords,
'strDescription' => $strDescription,
]);

View File

@@ -57,15 +57,29 @@ class Novel extends BaseController
$strStatus = '已完结';
$arrEdnNovelRankNovel = $NovelModel->getRankNovelOnCache($strKey, 10, 0, 'total', $strStatus);
// Title 模板
ConverterMovel::setVal([
'intPage' => 1,
]);
// $strTitle = $Request->DomainModel->getFomartSubject(getFomartSubjectKey(__METHOD__));
$strTitleTemplate = $Request->DomainModel->getFomartSubject(getFomartSubjectKey(__METHOD__) . '@TITLE');
$strKeywordsTemplate = $Request->DomainModel->getFomartSubject(getFomartSubjectKey(__METHOD__) . '@KEYWORDS');
$strDescriptionTemplate = $Request->DomainModel->getFomartSubject(getFomartSubjectKey(__METHOD__) . '@DESCRIPTION');
$strTitle = ConverterMovel::convert($strTitleTemplate);
$strKeywords = ConverterMovel::convert($strKeywordsTemplate);
$strDescription = ConverterMovel::convert($strDescriptionTemplate);
View::assign([
'arrDayRankNovel' => $arrDayRankNovel,
'arrWeekRankNovel' => $arrWeekRankNovel,
'arrMoonRankNovel' => $arrMoonRankNovel,
'arrTotalRankNovel' => $arrTotalRankNovel,
'arrNewsNovelRankNovel' => $arrNewsNovelRankNovel,
'arrEdnNovelRankNovel' => $arrEdnNovelRankNovel,
'strTitle' => $strTitle,
'strKeywords' => $strKeywords,
'strDescription' => $strDescription,
'strPageCode' => 'rank'
]);
if ($boolIsMobile) {
@@ -96,6 +110,11 @@ class Novel extends BaseController
'nansheng-xiaoshuo' => 1,
'nvsheng-xiaoshuo' => 1,
];
$arrSexChinese = [
'all' => '',
'nansheng-xiaoshuo' => '男生',
'nvsheng-xiaoshuo' => '女生',
];
if (!key_exists($strGender, $arrSex)) {
return response('Bad Request', 400);
@@ -105,7 +124,7 @@ class Novel extends BaseController
// 分类
if ($strCategory == 'all') {
$strSearchCategory = NULL;
$strSearchCategory = '';
} else if (!in_array($strCategory, CategoryModel::$arrCategoryPinYin)) {
return response('Bad Request', 400);
} else {
@@ -151,6 +170,25 @@ class Novel extends BaseController
$strBaseUrl = sprintf('/shuku/%s/%s/%s/page{page}', $strGender, $strCategory, $strStatus);
$arrPaginator = CusteomPage02::generate($intPage, $arrPage['total'], $intLimit, $strBaseUrl, $intButtomNum);
// TODO 下面的值要处理成汉字 start
// 更新值
ConverterMovel::setVal([
'intPage' => $intPage,
'strNovelSex' => $arrSexChinese[$strGender], //汉字 男生或者女生
'strNovelCategoryName' => str_replace("小说", "", $strSearchCategory), // 小说分类名汉字 玄幻 都市 。。。 ; 注意不要带 小说 2字tkd 会重复堆叠
'strNovelStatus' => $strSearchStatus, // 小说状态 汉字
]);
// TODO end
// $strTitle = $Request->DomainModel->getFomartSubject(getFomartSubjectKey(__METHOD__));
$strTitleTemplate = $Request->DomainModel->getFomartSubject(getFomartSubjectKey(__METHOD__) . '@TITLE');
$strKeywordsTemplate = $Request->DomainModel->getFomartSubject(getFomartSubjectKey(__METHOD__) . '@KEYWORDS');
$strDescriptionTemplate = $Request->DomainModel->getFomartSubject(getFomartSubjectKey(__METHOD__) . '@DESCRIPTION');
$strTitle = ConverterMovel::convert($strTitleTemplate);
$strKeywords = ConverterMovel::convert($strKeywordsTemplate);
$strDescription = ConverterMovel::convert($strDescriptionTemplate);
View::assign([
'arrNovel' => $arrPage['data'],
'strPageCode' => 'library',
@@ -159,12 +197,15 @@ class Novel extends BaseController
'strStatus' => $strStatus,
'intPage' => $intPage,
'intTotalPage' => $arrPage['pages'],
// TODO 返回所有分类了,应该只返回对应 性别的分类,暂时按下面的返回了,你看看要咋处理
// TODO 返回所有分类了,应该只返回对应 性别的分类,暂时按下面的返回了,你看看需要改不 start
// 'arrCategory' => array_combine(array_values(CategoryModel::$arrCategoryPinYin), array_values(CategoryModel::$arrCategory)),
'arrCategoryAll' => CategoryModel::$arrCategoryAll,
// TODO end
'arrPaginator' => $arrPaginator,
'strTitle' => $strTitle,
'strKeywords' => $strKeywords,
'strDescription' => $strDescription,
]);
return View::fetch($strTemplate);
@@ -224,12 +265,30 @@ class Novel extends BaseController
$intCount = 20;
$arrNewsUpdateNovel = $NovelModel->getCommonNovelOnCache($strKey, $intLifeTime, $intCount, $intType, NULL, ['og_novel_update_time' => -1]);
// 更新值
ConverterMovel::setVal([
'intPage' => 1,
'strNovelSex' => $strNovelChannel == 'boys' ? '男生' : '女生', //汉字 男生或者女生
]);
// $strTitle = $Request->DomainModel->getFomartSubject(getFomartSubjectKey(__METHOD__));
$strTitleTemplate = $Request->DomainModel->getFomartSubject(getFomartSubjectKey(__METHOD__) . '@TITLE');
$strKeywordsTemplate = $Request->DomainModel->getFomartSubject(getFomartSubjectKey(__METHOD__) . '@KEYWORDS');
$strDescriptionTemplate = $Request->DomainModel->getFomartSubject(getFomartSubjectKey(__METHOD__) . '@DESCRIPTION');
$strTitle = ConverterMovel::convert($strTitleTemplate);
$strKeywords = ConverterMovel::convert($strKeywordsTemplate);
$strDescription = ConverterMovel::convert($strDescriptionTemplate);
View::assign([
'arrRecommendSerializationNovel' => $arrRecommendSerializationNovel,
'arrRecommendEndNovel' => $arrRecommendEndNovel,
'arrNewsUpdateNovel' => $arrNewsUpdateNovel,
'arrAdBanner' => [],
'strPageCode' => $strNovelChannel
'strPageCode' => $strNovelChannel,
'strTitle' => $strTitle,
'strKeywords' => $strKeywords,
'strDescription' => $strDescription,
]);
if ($boolIsMobile) {
return View::fetch();
@@ -372,16 +431,26 @@ class Novel extends BaseController
$arrRelateveNovel = $NovelModel->getNovel(['n_id' => [
'$in' => $arrRelateveNId,
]], 10);
// echo '<pre>';
// var_dump($arrNovel);exit;
// $strNovel = '斗罗大陆';
// 更新值
ConverterMovel::setVal([
'intPage' => 1,
'strNovelName' => $arrNovel['og_novel_book_name'],
'strNovelAuthor' => $arrNovel['og_novel_author'],
'strNovelCategoryName' => $arrNovel['og_novel_category'],
'strNovelSex' => '男生', // TODO 汉字 男生或者女生
'strNovelStatus' => $arrNovel['og_novel_status'],
'strNovelDescription' => $arrNovel['n_page_description'],
]);
// ConverterMovel::setVal("strNovelName", $strNovel);
$strTitleTemplate = $Request->DomainModel->getFomartSubject('NOVEL@GETNOVELINFO@TITLE');
$strKeywordsTemplate = $Request->DomainModel->getFomartSubject('NOVEL@GETNOVELINFO@KEYWORDS');
$strDescriptionTemplate = $Request->DomainModel->getFomartSubject('NOVEL@GETNOVELINFO@DESCRIPTION');
// $strTitle = $Request->DomainModel->getFomartSubject(getFomartSubjectKey(__METHOD__));
$strTitle = ConverterMovel::convert($strTitleTemplate);
$strKeywords = ConverterMovel::convert($strKeywordsTemplate);
$strDescription = ConverterMovel::convert($strDescriptionTemplate);
// $strTitle = ConverterMovel::convert($strTitle);
View::assign([
'arrRelateveNovel' => $arrRelateveNovel,
@@ -390,7 +459,9 @@ class Novel extends BaseController
'arrNovelClicks' => $arrNovelClicks,
'strFocus' => $strFocus,
'strPageCode' => 'boy',
// 'strTitle' => $strTitle,
'strTitle' => $strTitle,
'strKeywords' => $strKeywords,
'strDescription' => $strDescription,
]);
if ($boolIsMobile) {
@@ -420,7 +491,6 @@ class Novel extends BaseController
// 分品拼音
$arrNovel['category_pinyin'] = CategoryModel::getPinYinByZh($arrNovel['og_novel_category']);
// 最后章节
$ChapterModel = new ChapterModel;
$arrLatestChapter = $ChapterModel->getLatestChapter($intNId);
@@ -452,16 +522,25 @@ class Novel extends BaseController
$arrRelateveNovel = $NovelModel->getNovel(['n_id' => [
'$in' => $arrRelateveNId,
]], 10);
// echo '<pre>';
// var_dump($arrNovel);exit;
$strNovel = '斗罗大陆';
// 更新值
ConverterMovel::setVal([
'intPage' => 1,
'strNovelName' => $arrNovel['og_novel_book_name'],
'strNovelAuthor' => $arrNovel['og_novel_author'],
'strNovelCategoryName' => $arrNovel['og_novel_category'],
'strNovelSex' => '男生', // TODO 汉字 男生或者女生
'strNovelStatus' => $arrNovel['og_novel_status'],
'strNovelDescription' => $arrNovel['n_page_description'],
]);
ConverterMovel::setVal("strNovelName", $strNovel);
$strTitleTemplate = $Request->DomainModel->getFomartSubject(getFomartSubjectKey(__METHOD__) . '@TITLE');
$strKeywordsTemplate = $Request->DomainModel->getFomartSubject(getFomartSubjectKey(__METHOD__) . '@KEYWORDS');
$strDescriptionTemplate = $Request->DomainModel->getFomartSubject(getFomartSubjectKey(__METHOD__) . '@DESCRIPTION');
$strTitle = $Request->DomainModel->getFomartSubject(getFomartSubjectKey(__METHOD__));
$strTitle = ConverterMovel::convert($strTitle);
$strTitle = ConverterMovel::convert($strTitleTemplate);
$strKeywords = ConverterMovel::convert($strKeywordsTemplate);
$strDescription = ConverterMovel::convert($strDescriptionTemplate);
View::assign([
'arrRelateveNovel' => $arrRelateveNovel,
@@ -471,6 +550,8 @@ class Novel extends BaseController
'strFocus' => $strFocus,
'strPageCode' => 'boy',
'strTitle' => $strTitle,
'strKeywords' => $strKeywords,
'strDescription' => $strDescription,
]);
if ($boolIsMobile) {
return View::fetch();
@@ -523,10 +604,26 @@ class Novel extends BaseController
['id' => 8, 'name' => '小说3', 'author' => '作者3'],
];
// 最新章节 取最新5章节
// 相邻推荐->关联的 kan 数据
// 精品推荐->同分类随机10条数据
// 最新要点->取新意章节, 随机提取一部分内容 大概150字数
// 更新值
ConverterMovel::setVal([
'intPage' => 1,
'strNovelName' => $arrNovel['og_novel_book_name'],
'strNovelAuthor' => $arrNovel['og_novel_author'],
'strNovelCategoryName' => $arrNovel['og_novel_category'],
'strNovelStatus' => $arrNovel['og_novel_status'],
'strNovelDescription' => $arrNovel['n_page_description'],
'strNovelChapterName' => $arrChapter['name'] ?? '',
'strNovelChapterSort' => $arrChapter['c_sort_num'] ?? '',
]);
$strTitleTemplate = $Request->DomainModel->getFomartSubject('NOVEL@GETNOVELCHAPTER@TITLE');
$strKeywordsTemplate = $Request->DomainModel->getFomartSubject('NOVEL@GETNOVELCHAPTER@KEYWORDS');
$strDescriptionTemplate = $Request->DomainModel->getFomartSubject('NOVEL@GETNOVELCHAPTER@DESCRIPTION');
$strTitle = ConverterMovel::convert($strTitleTemplate);
$strKeywords = ConverterMovel::convert($strKeywordsTemplate);
$strDescription = ConverterMovel::convert($strDescriptionTemplate);
View::assign([
'arrNewsNovel' => $arrNewsNovel,
@@ -542,6 +639,9 @@ class Novel extends BaseController
'intNovelId' => $intNId,
'intChapterSort' => $arrChapter['c_sort_num'] ?? 0,
'intChapterPage' => $arrChapter['c_page'] ?? 0,
'strTitle' => $strTitle,
'strKeywords' => $strKeywords,
'strDescription' => $strDescription,
]);
if ($boolIsMobile) {
return View::fetch('getNovelChapter');
@@ -583,9 +683,28 @@ class Novel extends BaseController
$arrNextChapter = $ChapterModel->getNextChapter($arrChapter['n_id'], $arrChapter['c_sort_num'], $arrChapter['c_page']);
}
$arrCategoryAll = CategoryModel::$arrCategoryAll;
// 更新值
ConverterMovel::setVal([
'intPage' => 1,
'strNovelName' => $arrNovel['og_novel_book_name'],
'strNovelAuthor' => $arrNovel['og_novel_author'],
'strNovelCategoryName' => $arrNovel['og_novel_category'],
'strNovelStatus' => $arrNovel['og_novel_status'],
'strNovelDescription' => $arrNovel['n_page_description'],
'strNovelChapterName' => $arrChapter['name'],
'strNovelChapterSort' => $arrChapter['c_sort_num'],
]);
$strTitleTemplate = $Request->DomainModel->getFomartSubject(getFomartSubjectKey(__METHOD__) . '@TITLE');
$strKeywordsTemplate = $Request->DomainModel->getFomartSubject(getFomartSubjectKey(__METHOD__) . '@KEYWORDS');
$strDescriptionTemplate = $Request->DomainModel->getFomartSubject(getFomartSubjectKey(__METHOD__) . '@DESCRIPTION');
$strTitle = ConverterMovel::convert($strTitleTemplate);
$strKeywords = ConverterMovel::convert($strKeywordsTemplate);
$strDescription = ConverterMovel::convert($strDescriptionTemplate);
View::assign([
'arrNovel' => $arrNovel,
'arrCategoryAll' => $arrCategoryAll,
@@ -596,6 +715,9 @@ class Novel extends BaseController
'intNovelId' => $intNovelId,
'intChapterSort' => $intChapterSort,
'intChapterPage' => $intChapterPage,
'strTitle' => $strTitle,
'strKeywords' => $strKeywords,
'strDescription' => $strDescription,
]);
if ($boolIsMobile) {
return View::fetch();
@@ -645,7 +767,26 @@ class Novel extends BaseController
$strBaseUrl = sprintf('/pc/xiaoshuo/%s-%s/mulu/%s/{page}', $arrNovel['og_novel_pin_yin'], $intNId, $strOrder);
$arrPaginator = CusteomPage02::generate($intPage, $arrPage['total'], $intLimit, $strBaseUrl, $intButtomNum);
// 更新值
ConverterMovel::setVal([
'intPage' => $intPage,
'strNovelSex' => '男生', // TODO 汉字 男生或者女生
'strNovelName' => $arrNovel['og_novel_book_name'],
'strNovelAuthor' => $arrNovel['og_novel_author'],
'strNovelCategoryName' => $arrNovel['og_novel_category'],
'strNovelStatus' => $arrNovel['og_novel_status'],
'strNovelDescription' => $arrNovel['n_page_description'],
]);
$strTitleTemplate = $Request->DomainModel->getFomartSubject(getFomartSubjectKey(__METHOD__) . '@TITLE');
$strKeywordsTemplate = $Request->DomainModel->getFomartSubject(getFomartSubjectKey(__METHOD__) . '@KEYWORDS');
$strDescriptionTemplate = $Request->DomainModel->getFomartSubject(getFomartSubjectKey(__METHOD__) . '@DESCRIPTION');
$strTitle = ConverterMovel::convert($strTitleTemplate);
$strKeywords = ConverterMovel::convert($strKeywordsTemplate);
$strDescription = ConverterMovel::convert($strDescriptionTemplate);
View::assign([
'arrNovel' => $arrNovel,
'arrPage' => $arrPage,
@@ -655,6 +796,9 @@ class Novel extends BaseController
'strOrder' => $strOrder,
'strPageCode' => 'chapters',
'intLimit' => $intLimit,
'strTitle' => $strTitle,
'strKeywords' => $strKeywords,
'strDescription' => $strDescription,
]);
if ($boolIsMobile) {
return View::fetch();
@@ -673,13 +817,13 @@ class Novel extends BaseController
{
$boolIsMobile = $Request->param('boolIsMobile');
$strKeywords = (string)$Request->get('keyword');
$strSearchKeywords = (string)$Request->get('keyword');
$intPage = (int)$Request->get('page', 1);
$intLimit = 20;
$strKey = sprintf('%s:PC:Novel:Search:%s:Page:%s:Limit:%s', $Request->DomainModel->d_domain, $strKeywords, $intPage, $intLimit);
$strKey = sprintf('%s:PC:Novel:Search:%s:Page:%s:Limit:%s', $Request->DomainModel->d_domain, $strSearchKeywords, $intPage, $intLimit);
if (empty($strKeywords)) {
if (empty($strSearchKeywords)) {
return response('请输入搜索的关键字', 400);
}
@@ -687,30 +831,49 @@ class Novel extends BaseController
$arrFilter = [
'$or' => [
['og_novel_book_name' => ['$regex' => $strKeywords, '$options' => 'i']],
['og_novel_author' => ['$regex' => $strKeywords, '$options' => 'i']],
['og_novel_category' => ['$regex' => $strKeywords, '$options' => 'i']],
['og_description' => ['$regex' => $strKeywords, '$options' => 'i']],
['og_novel_book_name' => ['$regex' => $strSearchKeywords, '$options' => 'i']],
['og_novel_author' => ['$regex' => $strSearchKeywords, '$options' => 'i']],
['og_novel_category' => ['$regex' => $strSearchKeywords, '$options' => 'i']],
['og_description' => ['$regex' => $strSearchKeywords, '$options' => 'i']],
]
];
$arrPage = $NovelModel->getCommonPageOnCache($arrFilter, $intPage, $intLimit, [], $strKey);
$intButtomNum = 10;
$strBaseUrl = sprintf('/search.html?keyword=%s&page={page}', $strKeywords);
$strBaseUrl = sprintf('/search.html?keyword=%s&page={page}', $strSearchKeywords);
$arrPaginator = CusteomPage02::generate($intPage, $arrPage['total'], $intLimit, $strBaseUrl, $intButtomNum);
// 更新值
ConverterMovel::setVal([
'intPage' => $intPage,
'strNovelSex' => '男生', // TODO 汉字 男生或者女生 // 取搜所的第一个小说的男生或者女生
'strSearchKeywords' => $strSearchKeywords,
'strNovelCategoryName' => '玄幻', // TODO 取搜所的第一个小说的分类 汉字(不带小说2字)
'strNovelStatus' => '完结', // TODO 取搜所的第一个小说的状态
]);
$strTitleTemplate = $Request->DomainModel->getFomartSubject(getFomartSubjectKey(__METHOD__) . '@TITLE');
$strKeywordsTemplate = $Request->DomainModel->getFomartSubject(getFomartSubjectKey(__METHOD__) . '@KEYWORDS');
$strDescriptionTemplate = $Request->DomainModel->getFomartSubject(getFomartSubjectKey(__METHOD__) . '@DESCRIPTION');
$strTitle = ConverterMovel::convert($strTitleTemplate);
$strKeywords = ConverterMovel::convert($strKeywordsTemplate);
$strDescription = ConverterMovel::convert($strDescriptionTemplate);
View::assign([
'arrPage' => $arrPage,
'arrPaginator' => $arrPaginator,
'strKeywords' => $strKeywords,
'strSearchKeywords' => $strSearchKeywords,
'intPage' => $intPage,
'intTotalPage' => $arrPage['pages'],
'strPageCode' => 'search'
'strPageCode' => 'search',
'strTitle' => $strTitle,
'strKeywords' => $strKeywords,
'strDescription' => $strDescription,
]);
// echo $strKeywords;exit;
if ($boolIsMobile) {
return View::fetch();
} else {