本次更新

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

@@ -3,80 +3,334 @@
namespace database\seeders;;
use app\model\TemplatesModel;
use app\model\SubjectFomartGroupModel;
use app\model\SubjectFomartModel;
class TemplateSeeder
{
static public function handle()
{
$arrData = [
/**
* 替换模板分组 数据播种
* 狂雨模板
*/
$arrSubjectFomartGroupData = [
// TKD
'INDEX@INDEX@TITLE' => [
'description' => '首页Title 替换模板分组ID',
'sfg_id' => 1,
'arrSubjectFomart' => [
'{strIndexTitle}',
]
],
'INDEX@INDEX@KEYWORDS' => [
'description' => '首页Keywords 替换模板分组ID',
'sfg_id' => 2,
'arrSubjectFomart' => [
'{strIndexKeywords}',
]
],
'INDEX@INDEX@DESCRIPTION' => [
'description' => '首页Description 替换模板分组ID',
'sfg_id' => 3,
'arrSubjectFomart' => [
'{strIndexDescription}',
]
],
'NOVEL@GETLIBRARY@TITLE' => [
'description' => '分类书库Title 替换模板分组ID',
'sfg_id' => 4,
'arrSubjectFomart' => [
'{strNovelSex}{strNovelCategoryName}{strNovelStatus}小说 - {strSiteName} - 第{intPage}页',
]
],
'NOVEL@GETLIBRARY@KEYWORDS' => [
'description' => '分类书库Keywords 替换模板分组ID',
'sfg_id' => 5,
'arrSubjectFomart' => [
'{strNovelCategoryName}小说, {strNovelSex}小说, {strNovelStatus}小说, {strSiteName}, 免费小说, 在线阅读',
]
],
'NOVEL@GETLIBRARY@DESCRIPTION' => [
'description' => '分类书库Description 替换模板分组ID',
'sfg_id' => 6,
'arrSubjectFomart' => [
'{strSiteName}提供{strNovelSex}{strNovelCategoryName}{strNovelStatus}小说免费在线阅读,第{intPage}页精选热门作品,畅享{strSiteDomain}',
]
],
'NOVEL@GETNOVELCHANNEL@TITLE' => [
'description' => '男女生Title 替换模板分组ID',
'sfg_id' => 7,
'arrSubjectFomart' => [
'{strNovelSex}小说 - {strSiteName} - 免费阅读 - 第{intPage}页',
]
],
'NOVEL@GETNOVELCHANNEL@KEYWORDS' => [
'description' => '男女生Keywords 替换模板分组ID',
'sfg_id' => 8,
'arrSubjectFomart' => [
'{strNovelSex}小说 - {strSiteKeywords} - 免费阅读 - 第{intPage}页',
]
],
'NOVEL@GETNOVELCHANNEL@DESCRIPTION' => [
'description' => '男女生Description 替换模板分组ID',
'sfg_id' => 9,
'arrSubjectFomart' => [
'{strNovelSex}小说 - {strSiteName} - 免费阅读 - 第{intPage}页',
]
],
'NOVEL@GETNOVELINFO@TITLE' => [
'description' => '详情Title 替换模板分组ID',
'sfg_id' => 10,
'arrSubjectFomart' => [
'{strNovelName} - {strNovelAuthor} - {strSiteName} - 免费阅读',
]
],
'NOVEL@GETNOVELINFO@KEYWORDS' => [
'description' => '详情Keywords 替换模板分组ID',
'sfg_id' => 11,
'arrSubjectFomart' => [
'{strNovelName}, {strNovelAuthor}, {strNovelCategoryName}小说, {strNovelSex}小说, {strNovelStatus}小说, {strSiteName}, 免费阅读',
]
],
'NOVEL@GETNOVELINFO@DESCRIPTION' => [
'description' => '详情Description 替换模板分组ID',
'sfg_id' => 12,
'arrSubjectFomart' => [
'{strSiteName}提供{strNovelName}免费在线阅读,{strNovelAuthor}创作的{strNovelCategoryName}{strNovelStatus}小说,{strNovelDescription},欢迎体验{strSiteDomain}',
]
],
'NOVEL@GETNOVELCHAPTERALL@TITLE' => [
'description' => '目录Title 替换模板分组ID',
'sfg_id' => 13,
'arrSubjectFomart' => [
'{strNovelName}章节目录 - {strSiteName} - 第{intPage}页',
]
],
'NOVEL@GETNOVELCHAPTERALL@KEYWORDS' => [
'description' => '目录Keywords 替换模板分组ID',
'sfg_id' => 14,
'arrSubjectFomart' => [
'{strNovelName}, {strNovelName}章节目录, {strNovelAuthor}, {strNovelCategoryName}小说, {strNovelSex}小说, {strSiteKeywords}, {strSiteName}',
]
],
'NOVEL@GETNOVELCHAPTERALL@DESCRIPTION' => [
'description' => '目录Description 替换模板分组ID',
'sfg_id' => 15,
'arrSubjectFomart' => [
'{strSiteName}提供{strNovelName}章节目录免费查看,第{intPage}页包含最新{strNovelStatus}章节,{strNovelAuthor}创作,畅享{strSiteDomain}',
]
],
'NOVEL@GETNOVELCHAPTER@TITLE' => [
'description' => '内容Title 替换模板分组ID',
'sfg_id' => 16,
'arrSubjectFomart' => [
'{strNovelName} 第{strNovelChapterSort}章 {strNovelChapterName} - {strSiteName}',
]
],
'NOVEL@GETNOVELCHAPTER@KEYWORDS' => [
'description' => '内容Keywords 替换模板分组ID',
'sfg_id' => 17,
'arrSubjectFomart' => [
'{strNovelName}, 第{strNovelChapterSort}章, {strNovelChapterName}, {strNovelAuthor}, {strSiteKeywords}, {strSiteName}, 免费阅读',
]
],
'NOVEL@GETNOVELCHAPTER@DESCRIPTION' => [
'description' => '内容Description 替换模板分组ID',
'sfg_id' => 18,
'arrSubjectFomart' => [
'{strSiteName}提供{strNovelName}第{strNovelChapterSort}章{strNovelChapterName}免费阅读,{strNovelAuthor}创作,畅享{strSiteDomain}',
]
],
'NOVEL@GETNOVELRANK@TITLE' => [
'description' => '排行榜Title 替换模板分组ID',
'sfg_id' => 19,
'arrSubjectFomart' => [
'小说排行榜 - {strSiteName} - 第{intPage}页',
]
],
'NOVEL@GETNOVELRANK@KEYWORDS' => [
'description' => '排行榜Keywords 替换模板分组ID',
'sfg_id' => 20,
'arrSubjectFomart' => [
'小说排行榜, 热门小说, 小说推荐, {strSiteKeywords}, {strSiteName}, 免费阅读',
]
],
'NOVEL@GETNOVELRANK@DESCRIPTION' => [
'description' => '排行榜Description 替换模板分组ID',
'sfg_id' => 21,
'arrSubjectFomart' => [
'{strSiteName}提供小说排行榜,第{intPage}页精选热门小说免费阅读,最新排行一览无余,畅享{strSiteDomain}',
]
],
'NOVEL@GETSEARCHNOVEL@TITLE' => [
'description' => '搜索页Title 替换模板分组ID',
'sfg_id' => 22,
'arrSubjectFomart' => [
'{strSearchKeywords} - 免费{strNovelSex}{strNovelCategoryName}小说阅读 - {strSiteName} - 第{intPage}页',
]
],
'NOVEL@GETSEARCHNOVEL@KEYWORDS' => [
'description' => '搜索页Keywords 替换模板分组ID',
'sfg_id' => 23,
'arrSubjectFomart' => [
'{strSearchKeywords}, {strNovelCategoryName}, {strNovelSex}小说, 免费小说, {strSiteName}, {strSiteDomain}',
]
],
'NOVEL@GETSEARCHNOVEL@DESCRIPTION' => [
'description' => '搜索页Description 替换模板分组ID',
'sfg_id' => 24,
'arrSubjectFomart' => [
'{strSiteName}为您提供{strSearchKeywords}相关的{strNovelSex}{strNovelCategoryName}小说免费阅读资源。第{intPage}页精选热门作品,畅享高质量阅读体验,欢迎访问{strSiteDomain}',
]
],
// URL
'CATEGORY_INFO_URL' => [
'description' => '分类书库URL 替换模板分组ID',
'sfg_id' => 25,
'arrSubjectFomart' => [
'/shuku/{strGender}/{strCategory}/{strStatus}/page{intPage}',
]
],
'NAN_SHENG_URL' => [
'description' => '男生URL 替换模板分组ID',
'sfg_id' => 26,
'arrSubjectFomart' => [
'/nansheng-xiaoshuo',
]
],
'NV_SHENG_URL' => [
'description' => '女生URL 替换模板分组ID',
'sfg_id' => 27,
'arrSubjectFomart' => [
'/nvsheng-xiaoshuo',
]
],
'RANK_INFO_URL' => [
'description' => '排行榜URL 替换模板分组ID',
'sfg_id' => 28,
'arrSubjectFomart' => [
'/paihang/all',
]
],
'NOVEL_INFO_URL' => [
'description' => '小说详情URL 替换模板分组ID',
'sfg_id' => 29,
'arrSubjectFomart' => [
'/xiaoshuo/{strPinYin}-{intNId}',
'/novel/{strPinYin}-{intNId}',
'/book/{strPinYin}-{intNId}',
'/xiaoshuo-{strPinYin}-{intNId}',
'/novel-{strPinYin}-{intNId}',
'/book-{strPinYin}-{intNId}',
]
],
'KAN_NOVEL_INFO_URL' => [
'description' => 'kan小说详情URL 替换模板分组ID',
'sfg_id' => 30,
'arrSubjectFomart' => [
'/kan-xiaoshuo/{strPinYin}-{intNId}',
]
],
'TABLE_INFO_URL' => [
'description' => '小说目录URL 替换模板分组ID',
'sfg_id' => 31,
'arrSubjectFomart' => [
'/xiaoshuo/{strPinYin}-{intNId}/mulu/{strOrder}/{intPage}',
]
],
'CONTENT_INFO_URL' => [
'description' => '内容章节URL 替换模板分组ID',
'sfg_id' => 32,
'arrSubjectFomart' => [
'/xiaoshuo/{strPinYin}-{intNId}/zhang-{intChapterSort}/{intChapterPage}',
]
],
'NEWS_CONTENT_INFO_URL' => [
'description' => '最新章节特殊页URL 替换模板分组ID',
'sfg_id' => 33,
'arrSubjectFomart' => [
'/books/{strPinYin}-{intNId}/chapter/latest',
]
],
'SEARCH_INFO_URL' => [
'description' => '搜索页URL 替换模板分组ID',
'sfg_id' => 34,
'arrSubjectFomart' => [
'/search?keywords={strSearchKeywords}&page={intPage}',
]
],
];
/**
* 视图模板 数据播种
*/
$arrTemplateData = [
[
't_id' => 1,
't_default' => 1,
't_code' => 'default',
't_path' => '/app/home/view/default/',
't_cfg_template' => [
'HOME@GETPCINDEX' => [
'description' => '首页Title 替换模板分组ID',
'sfg_id' => 0,
],
'NOVEL@GETNOVELINFO' => [
'description' => '小说详情TITLE 替换模板分组ID',
'sfg_id' => 0,
],
'NOVEL_INFO_URL' => [
'description' => '小说详情URL 替换模板分组ID',
'sfg_id' => 0,
],
],
't_cfg_template' => $arrSubjectFomartGroupData,
],
[
't_id' => 2,
't_default' => 0,
't_code' => 'kuangYu',
't_path' => '/app/home/view/kuangYu/',
't_cfg_template' => [
'INDEX@GETPCINDEX' => [
'description' => '首页Title 替换模板分组ID',
'sfg_id' => 0,
],
'NOVEL@GETNOVELINFO' => [
'description' => '小说详情TITLE 替换模板分组ID',
'sfg_id' => 0,
],
'NOVEL_INFO_URL' => [
'description' => '小说详情URL 替换模板分组ID',
'sfg_id' => 0,
],
],
],
[
't_id' => 3,
't_default' => 0,
't_code' => 'haoZi',
't_path' => '/app/home/view/haoZi/',
],
[
't_id' => 4,
't_default' => 0,
't_code' => 'xiongMao',
't_path' => '/app/home/view/xiongMao/',
],
[
't_id' => 5,
't_default' => 0,
't_code' => 'shiKong',
't_path' => '/app/home/view/shiKong/',
't_cfg_template' => $arrSubjectFomartGroupData,
],
// [
// 't_id' => 3,
// 't_default' => 0,
// 't_code' => 'haoZi',
// 't_path' => '/app/home/view/haoZi/',
// ],
// [
// 't_id' => 4,
// 't_default' => 0,
// 't_code' => 'xiongMao',
// 't_path' => '/app/home/view/xiongMao/',
// ],
// [
// 't_id' => 5,
// 't_default' => 0,
// 't_code' => 'shiKong',
// 't_path' => '/app/home/view/shiKong/',
// ],
];
foreach ($arrData as $arrTemplate) {
$TemplatesModel = TemplatesModel::where('t_id', $arrTemplate['t_id'])->find();
self::initTemplate($arrTemplateData);
self::initSubjectFomartGroup($arrSubjectFomartGroupData);
}
/**
* 视图模板 数据播种
*
* @param [type] $arrTemplateData
* @return void
*/
static public function initTemplate($arrTemplateData)
{
foreach ($arrTemplateData as $arrTemplate) {
$TemplatesModel = TemplatesModel::where('t_id', $arrTemplate['t_id'])->find();
foreach ($arrTemplate['t_cfg_template'] as $key => $arrCfgTemplate) {
unset($arrTemplate['t_cfg_template'][$key]['arrSubjectFomart']);
}
if (empty($TemplatesModel)) {
TemplatesModel::insert($arrTemplate);
}else {
} else {
// 如果记录存在,更新记录
$TemplatesModel->update($arrTemplate);
}
@@ -84,4 +338,47 @@ class TemplateSeeder
TemplatesModel::flushCache();
}
/**
* 替换模板分组/替换模板 数据播种
*
* @param [type] $arrTemplateData
* @return void
*/
static public function initSubjectFomartGroup($arrSubjectFomartGroupData)
{
foreach ($arrSubjectFomartGroupData as $SubjectFomartGroup) {
$SubjectFomartGroupModel = SubjectFomartGroupModel::where('sfg_id', $SubjectFomartGroup['sfg_id'])->find();
$SubjectFomartGroupItem = [
'sfg_id' => $SubjectFomartGroup['sfg_id'],
'sfg_name' => str_replace(" 替换模板分组ID", "", $SubjectFomartGroup['description']),
'sfg_description' => str_replace(" 替换模板分组ID", "", $SubjectFomartGroup['description']),
];
foreach ($SubjectFomartGroup['arrSubjectFomart'] as $SubjectFomart) {
$SubjectFomartItem = [
'sfg_id' => $SubjectFomartGroup['sfg_id'],
'sf_val' => $SubjectFomart
];
$SubjectFomartModel = SubjectFomartModel::where('sfg_id', $SubjectFomartItem['sfg_id'])->where('sf_val', $SubjectFomart)->find();
if (empty($SubjectFomartModel)) {
SubjectFomartModel::insert($SubjectFomartItem);
} else {
// 如果记录存在,更新记录
$SubjectFomartModel->where('sf_id', $SubjectFomartModel->sf_id)->update($SubjectFomartItem);
};
};
if (empty($SubjectFomartGroupModel)) {
SubjectFomartGroupModel::insert($SubjectFomartGroupItem);
} else {
// 如果记录存在,更新记录
$SubjectFomartGroupModel->update($SubjectFomartGroupItem);
}
}
// SubjectFomartGroupModel::flushCache();
}
}