This commit is contained in:
make
2025-04-11 20:52:26 +08:00
parent 1d482274c2
commit 89bbd72eb4
3 changed files with 486 additions and 16 deletions

View File

@@ -7,14 +7,17 @@ use app\home\controller\Novel;
use app\home\controller\User; use app\home\controller\User;
use think\facade\Route; use think\facade\Route;
# 路由别名,可以忽略 ->ext('html') // 加载路由配置文件(从 config 目录)
// Route::alias("/index.html", "/")->append(['boolIsMobile' => true]); $arrRoutes = include config_path('routes.php');
// Route::alias("/pc/index.html", "/")->append(['boolIsMobile' => false]);
/** /**
* 首页 * 首页 - h5
*/ */
Route::get("/", [Index::class, 'index'])->ext('html')->append(['boolIsMobile' => true]); Route::get("/", [Index::class, 'index'])->ext('html')->append(['boolIsMobile' => true]);
/**
* 首页 - pc
*/
Route::get("/pc/", [Index::class, 'getPcIndex'])->append(['boolIsMobile' => false]); Route::get("/pc/", [Index::class, 'getPcIndex'])->append(['boolIsMobile' => false]);
Route::get("/web/", [Index::class, 'getPcIndex'])->append(['boolIsMobile' => false]); Route::get("/web/", [Index::class, 'getPcIndex'])->append(['boolIsMobile' => false]);
Route::get("/desktop/", [Index::class, 'getPcIndex'])->append(['boolIsMobile' => false]); Route::get("/desktop/", [Index::class, 'getPcIndex'])->append(['boolIsMobile' => false]);
@@ -455,29 +458,77 @@ Route::get('/pc/find', [Novel::class, 'getSearchNovel'])->ext('html')->append(['
Route::get('/pc/query', [Novel::class, 'getSearchNovel'])->ext('html')->append(['boolIsMobile' => false]); Route::get('/pc/query', [Novel::class, 'getSearchNovel'])->ext('html')->append(['boolIsMobile' => false]);
Route::get('/pc/keywords', [Novel::class, 'getSearchNovel'])->ext('html')->append(['boolIsMobile' => false]); Route::get('/pc/keywords', [Novel::class, 'getSearchNovel'])->ext('html')->append(['boolIsMobile' => false]);
// 小说用户中心 /**
* 小说用户中心 - h5
*/
Route::get('/user', [User::class, 'Index'])->append(['boolIsMobile' => true]); Route::get('/user', [User::class, 'Index'])->append(['boolIsMobile' => true]);
Route::get('/my-account', [User::class, 'Index'])->append(['boolIsMobile' => true]);
Route::get('/profile', [User::class, 'Index'])->append(['boolIsMobile' => true]);
Route::get('/yonghu', [User::class, 'Index'])->append(['boolIsMobile' => true]);
Route::get('/wode-zhongxin', [User::class, 'Index'])->append(['boolIsMobile' => true]);
Route::get('/personal-center', [User::class, 'Index'])->append(['boolIsMobile' => true]);
/**
* 小说用户中心 - pc
*/
Route::get('/pc/user', [User::class, 'Index'])->append(['boolIsMobile' => false]); Route::get('/pc/user', [User::class, 'Index'])->append(['boolIsMobile' => false]);
Route::get('/pc/my-account', [User::class, 'Index'])->append(['boolIsMobile' => false]);
Route::get('/pc/profile', [User::class, 'Index'])->append(['boolIsMobile' => false]);
Route::get('/pc/yonghu', [User::class, 'Index'])->append(['boolIsMobile' => false]);
Route::get('/pc/wode-zhongxin', [User::class, 'Index'])->append(['boolIsMobile' => false]);
Route::get('/pc/personal-center', [User::class, 'Index'])->append(['boolIsMobile' => false]);
// 书架 /**
* 书架 - h5
*/
Route::get('/bookshelf', [User::class, 'getBookShelf'])->append(['boolIsMobile' => true]); Route::get('/bookshelf', [User::class, 'getBookShelf'])->append(['boolIsMobile' => true]);
Route::get('/pc/bookshelf', [User::class, 'getBookShelf'])->append(['boolIsMobile' => false]); Route::get('/book-shelf', [User::class, 'getBookShelf'])->append(['boolIsMobile' => true]);
Route::get('/reading-shelf', [User::class, 'getBookShelf'])->append(['boolIsMobile' => true]);
Route::get('/shujia', [User::class, 'getBookShelf'])->append(['boolIsMobile' => true]);
Route::get('/yuedu-shujia', [User::class, 'getBookShelf'])->append(['boolIsMobile' => true]);
Route::get('/book-collection', [User::class, 'getBookShelf'])->append(['boolIsMobile' => true]);
// 历史记录 /**
* 书架 - pc
*/
Route::get('/pc/bookshelf', [User::class, 'getBookShelf'])->append(['boolIsMobile' => false]);
Route::get('/pc/book-shelf', [User::class, 'getBookShelf'])->append(['boolIsMobile' => false]);
Route::get('/pc/reading-shelf', [User::class, 'getBookShelf'])->append(['boolIsMobile' => false]);
Route::get('/pc/shujia', [User::class, 'getBookShelf'])->append(['boolIsMobile' => false]);
Route::get('/pc/yuedu-shujia', [User::class, 'getBookShelf'])->append(['boolIsMobile' => false]);
Route::get('/pc/book-collection', [User::class, 'getBookShelf'])->append(['boolIsMobile' => false]);
/**
* 历史记录 - h5
*/
Route::get('/history', [User::class, 'getHistory'])->append(['boolIsMobile' => true]); Route::get('/history', [User::class, 'getHistory'])->append(['boolIsMobile' => true]);
Route::get('/reading-history', [User::class, 'getHistory'])->append(['boolIsMobile' => true]);
Route::get('/read-record', [User::class, 'getHistory'])->append(['boolIsMobile' => true]);
Route::get('/lishi', [User::class, 'getHistory'])->append(['boolIsMobile' => true]);
Route::get('/yuedu-lishi', [User::class, 'getHistory'])->append(['boolIsMobile' => true]);
Route::get('/browse-past', [User::class, 'getHistory'])->append(['boolIsMobile' => true]);
/**
* 历史记录 - pc
*/
Route::get('/pc/history', [User::class, 'getHistory'])->append(['boolIsMobile' => false]); Route::get('/pc/history', [User::class, 'getHistory'])->append(['boolIsMobile' => false]);
Route::get('/pc/reading-history', [User::class, 'getHistory'])->append(['boolIsMobile' => false]);
Route::get('/pc/read-record', [User::class, 'getHistory'])->append(['boolIsMobile' => false]);
Route::get('/pc/lishi', [User::class, 'getHistory'])->append(['boolIsMobile' => false]);
Route::get('/pc/yuedu-lishi', [User::class, 'getHistory'])->append(['boolIsMobile' => false]);
Route::get('/pc/browse-past', [User::class, 'getHistory'])->append(['boolIsMobile' => false]);
// 文章 列表 // 文章 列表
Route::get('/article/list-[:intCategoryId]-[:intPage]', [Novel::class, 'getArticleList'])->append(['boolIsMobile' => true]); // Route::get('/article/list-[:intCategoryId]-[:intPage]', [Novel::class, 'getArticleList'])->append(['boolIsMobile' => true]);
Route::get('/pc/article/list-[:intCategoryId]-[:intPage]', [Novel::class, 'getArticleList'])->append(['boolIsMobile' => false]); // Route::get('/pc/article/list-[:intCategoryId]-[:intPage]', [Novel::class, 'getArticleList'])->append(['boolIsMobile' => false]);
Route::get('/article/list', [Novel::class, 'getArticleList'])->append(['boolIsMobile' => true]); // Route::get('/article/list', [Novel::class, 'getArticleList'])->append(['boolIsMobile' => true]);
Route::get('/pc/article/list', [Novel::class, 'getArticleList'])->append(['boolIsMobile' => false]); // Route::get('/pc/article/list', [Novel::class, 'getArticleList'])->append(['boolIsMobile' => false]);
// 文章 详情 // // 文章 详情
Route::get('/article/info-:intArticleId', [Novel::class, 'getArticleInfo'])->append(['boolIsMobile' => true]); // Route::get('/article/info-:intArticleId', [Novel::class, 'getArticleInfo'])->append(['boolIsMobile' => true]);
Route::get('/pc/article/info-:intArticleId', [Novel::class, 'getArticleInfo'])->append(['boolIsMobile' => false]); // Route::get('/pc/article/info-:intArticleId', [Novel::class, 'getArticleInfo'])->append(['boolIsMobile' => false]);
@@ -500,6 +551,208 @@ Route::get('/pc/article/info-:intArticleId', [Novel::class, 'getArticleInfo'])->
/**
* 首页 - h5
*/
Route::get("/", [Index::class, 'index'])->ext('html')->append(['boolIsMobile' => true]);
/**
* 首页 - pc
*/
Route::get("/pc/", [Index::class, 'getPcIndex'])->append(['boolIsMobile' => false]);
/**
* 排行榜 - h5
*/
Route::get('/paihang/all', [Novel::class, 'getNovelRank'])->append(['boolIsMobile' => true]);
/**
* 排行榜 - pc
*/
Route::get("/pc/paihang/all", [Novel::class, 'getNovelRank'])->append(['boolIsMobile' => false]);
/**
* 男生 - h5
*/
Route::get('/nansheng-xiaoshuo', [Novel::class, 'getNovelChannel'])->append(['boolIsMobile' => true, 'strChannel' => 'boys']);
/**
* 男生 - pc
*/
Route::get('/pc/nansheng-xiaoshuo', [Novel::class, 'getNovelChannel'])->append(['boolIsMobile' => false, 'strChannel' => 'boys']);
/**
* 女生 - h5
*/
Route::get('/nvsheng-xiaoshuo', [Novel::class, 'getNovelChannel'])->append(['boolIsMobile' => true, 'strChannel' => 'girls']);
/**
* 女生 - pc
*/
Route::get('/pc/nvsheng-xiaoshuo', [Novel::class, 'getNovelChannel'])->append(['boolIsMobile' => false, 'strChannel' => 'girls']);
/**
* 书库 h5
*/
Route::get('/shuku/:strGender/:strCategory/:strStatus/page:intPage', [Novel::class, 'getLibrary'])
->pattern([
'strGender' => 'nansheng-xiaoshuo|nvsheng-xiaoshuo|all',
'strCategory' => '[a-z\-]+',
'strStatus' => 'all|lianzai|wanjie',
'intPage' => '\d+'
])
->append(['boolIsMobile' => true]);
/**
* 书库 - pc
*/
Route::get('/pc/shuku/:strGender/:strCategory/:strStatus/page:intPage', [Novel::class, 'getLibrary'])
->pattern([
'strGender' => 'nansheng-xiaoshuo|nvsheng-xiaoshuo|all',
'strCategory' => '[a-z\-]+',
'strStatus' => 'all|lianzai|wanjie',
'intPage' => '\d+'
])
->append(['boolIsMobile' => false]);
/**
* 书库首页-h5
*/
Route::get('/shuku/all', [Novel::class, 'getLibrary'])->append(['boolIsMobile' => true]);
/**
* 书库首页-pc
*/
Route::get('/pc/shuku/all', [Novel::class, 'getLibrary'])->append(['boolIsMobile' => false]);
/**
* 小说章节 - h5
* /xiaoshuo/小说拼音-小说id/zhang-章节排序/章节分页
* /xiaoshuo/小说拼音-小说id/di-章节排序-zhang/章节分页
*/
Route::get('/xiaoshuo/:name-:intNovelId/zhang-:intChapterSort/[:intChapterPage]', [Novel::class, 'getNovelChapter'])
->append(['boolIsMobile' => true, 'intUriType' => 1])
->pattern(['intNovelId' => '\d+', 'name' => '[\w-]+', 'intChapterSort' => '\d+', 'intChapterPage' => '\d+']);
/**
* 小说章节 - pc
*/
Route::get('/pc/xiaoshuo/:name-:intNovelId/zhang-:intChapterSort/[:intChapterPage]', [Novel::class, 'getNovelChapter'])
->append(['boolIsMobile' => false, 'intUriType' => 1])
->pattern(['intNovelId' => '\d+', 'name' => '[\w-]+', 'intChapterSort' => '\d+', 'intChapterPage' => '\d+']);
/**
* 最新章节-特殊页面处理-pc
*/
Route::get('/pc/xiaoshuo/:name-:n_id/chapter/latest', [Novel::class, 'getNovelLatestChapter'])
->append(['boolIsMobile' => false, 'intUriType' => 1])
->pattern(['n_id' => '\d+', 'name' => '[\w-]+',]);
/**
* 最新章节-特殊页面处理-h5
*/
Route::get('/xiaoshuo/:name-:n_id/chapter/latest', [Novel::class, 'getNovelLatestChapter'])
->append(['boolIsMobile' => false, 'intUriType' => 1])
->pattern(['n_id' => '\d+', 'name' => '[\w-]+',]);
/**
* 小说目录页面-h5
* /xiaoshuo/[小说拼音]-[小说id]/mulu/order/[page]
*/
Route::get('/xiaoshuo/:name-:intNovelId/mulu/:strOrder/[:intPage]', [Novel::class, 'getNovelChapterAll'])
->append(['boolIsMobile' => true, 'intUriType' => 1])
->pattern(['intNovelId' => '\d+', 'name' => '[\w-]+', 'strOrder' => 'zheng|dao', 'intPage' => '\d+']);
/**
* 小说目录页面-pc
*/
Route::get('/pc/xiaoshuo/:name-:intNovelId/mulu/:strOrder/[:intPage]', [Novel::class, 'getNovelChapterAll'])
->append(['boolIsMobile' => false, 'intUriType' => 1])
->pattern(['intNovelId' => '\d+', 'name' => '[\w-]+', 'strOrder' => 'zheng|dao', 'intPage' => '\d+']);
/**
* 伪小说详情-pc
*/
Route::get('/pc/kan-xiaoshuo/:name-:n_id-:n_forge_id', [Novel::class, 'getKanNovelInfo'])
->append(['boolIsMobile' => false, 'intUriType' => 2])
->pattern(['n_id' => '\d+', 'n_forge_id' => '\d+', 'name' => '[\w-]+',]);
/**
* 伪小说详情-h5
*/
Route::get('/kan-xiaoshuo/:name-:n_id-:n_forge_id', [Novel::class, 'getKanNovelInfo'])
->append(['boolIsMobile' => true, 'intUriType' => 2])
->pattern(['n_id' => '\d+', 'n_forge_id' => '\d+', 'name' => '[\w-]+',]);
/**
* 小说详情-pc
*/
Route::get('/pc/xiaoshuo/:name-:n_id', [Novel::class, 'getNovelInfo'])
->append(['boolIsMobile' => false, 'intUriType' => 2])
->pattern(['n_id' => '\d+', 'name' => '[\w-]+',]);
/**
* 小说详情-h5
*/
Route::get('/xiaoshuo/:name-:n_id', [Novel::class, 'getNovelInfo'])
->append(['boolIsMobile' => true, 'intUriType' => 2])
->pattern(['n_id' => '\d+', 'name' => '[\w-]+',]);
/**
* 搜索小说 - h5
*/
Route::get('/search', [Novel::class, 'getSearchNovel'])->ext('html')->append(['boolIsMobile' => true]);
/**
* 搜索小说 - pc
*/
Route::get('/pc/search', [Novel::class, 'getSearchNovel'])->ext('html')->append(['boolIsMobile' => false]);
/**
* 小说用户中心 - h5
*/
Route::get('/user', [User::class, 'Index'])->append(['boolIsMobile' => true]);
/**
* 小说用户中心 - pc
*/
Route::get('/pc/user', [User::class, 'Index'])->append(['boolIsMobile' => false]);
/**
* 书架 - h5
*/
Route::get('/bookshelf', [User::class, 'getBookShelf'])->append(['boolIsMobile' => true]);
/**
* 书架 - pc
*/
Route::get('/pc/bookshelf', [User::class, 'getBookShelf'])->append(['boolIsMobile' => false]);
/**
* 历史记录 - h5
*/
Route::get('/history', [User::class, 'getHistory'])->append(['boolIsMobile' => true]);
/**
* 历史记录 - pc
*/
Route::get('/pc/history', [User::class, 'getHistory'])->append(['boolIsMobile' => false]);

83
code/config/routes.php Normal file
View File

@@ -0,0 +1,83 @@
<?php
// +----------------------------------------------------------------------
// | 路由 配置
// +----------------------------------------------------------------------
return [
// H5/PC 端前缀
'prefixes' => ['', '/pc', '/web', '/desktop', '/index', '/shouye', '/zhuomian'],
// 通用路径别名
'paths' => [
// 书库
'library' => [
'/shuku/:strGender/:strCategory/:strStatus/page:intPage',
'/books/:strGender/:strCategory/:strStatus/page:intPage',
'/library/:strGender/:strCategory/:strStatus/page:intPage',
'/fenlei/:strGender/:strCategory/:strStatus/page:intPage',
'/class/:strGender/:strCategory/:strStatus/page:intPage',
'/category/:strGender/:strCategory/:strStatus/page:intPage',
],
// 书库首页
'library-index' => [
'/shuku/all',
'/books/all',
'/library/all',
'/fenlei/all',
'/class/all',
'/category/all',
],
// 小说详情相关路径
'novel' => [
'/xiaoshuo/:name-:n_id',
'/novel/:name-:n_id',
'/book/:name-:n_id',
'/xiaoshuo-:name-:n_id',
'/novel-:name-:n_id',
'/book-:name-:n_id',
],
// 章节相关路径
'chapter' => [
'/xiaoshuo/:name-:intNovelId/zhang-:intChapterSort/[:intChapterPage]',
'/novel/:name-:intNovelId/zhang-:intChapterSort/[:intChapterPage]',
'/book/:name-:intNovelId/zhang-:intChapterSort/[:intChapterPage]',
'/xiaoshuo-:name-:intNovelId/zhang-:intChapterSort/[:intChapterPage]',
'/novel-:name-:intNovelId/zhang-:intChapterSort/[:intChapterPage]',
'/book-:name-:intNovelId/zhang-:intChapterSort/[:intChapterPage]',
],
// 目录相关路径
'catalog' => [
'/xiaoshuo/:name-:intNovelId/mulu/:strOrder/[:intPage]',
'/novel/:name-:intNovelId/mulu/:strOrder/[:intPage]',
'/book/:name-:intNovelId/mulu/:strOrder/[:intPage]',
'/xiaoshuo/:name-:intNovelId/mulu/:strOrder/[:intPage]',
'/novel/:name-:intNovelId/mulu/:strOrder/[:intPage]',
'/book/:name-:intNovelId/mulu/:strOrder/[:intPage]',
],
// 最新章节-特殊页面处理
'latest' => [
'/xiaoshuo/:name-:n_id/chapter/latest',
'/novel/:name-:n_id/chapter/latest',
'/book/:name-:n_id/chapter/latest',
'/xiaoshuo-:name-:n_id/chapter/latest',
'/novel-:name-:n_id/chapter/latest',
'/book-:name-:n_id/chapter/latest',
],
'rank' => ['/paihang/all', '/rank/all', '/paihang-quan', '/top/all', '/paihang-bang', '/ranks/all'], //排行榜
'boys' => ['/nansheng-xiaoshuo', '/boys-novel', '/nansheng-shu', '/man-read', '/nansheng-book', '/male-novels'], // 男生
'girls' => ['/nvsheng-xiaoshuo', '/girls-novel', '/nvsheng-shu', '/woman-read', '/nvsheng-book', '/female-novels'], //女生
'search' => ['/search', '/explore', '/sousuo', '/find', '/query', '/keywords'], //搜索
'user' => ['/user', '/my-account', '/profile', '/yonghu', '/wode-zhongxin', '/personal-center'], // 用户中心
'bookshelf' => ['/bookshelf', '/book-shelf', '/reading-shelf', '/shujia', '/yuedu-shujia', '/book-collection'], //书架
'history' => ['/history', '/reading-history', '/read-record', '/lishi', '/yuedu-lishi', '/browse-past'], // ;历史记录
'index' => ['', 'web', 'desktop', 'index', 'shouye'], // 首页,包含空路径
],
];

View File

@@ -316,6 +316,28 @@ class TemplateSeeder
'/search.html?keywords={strSearchKeywords}&page={intPage}', '/search.html?keywords={strSearchKeywords}&page={intPage}',
] ]
], ],
'HISTORY_INFO_URL' => [
'description' => '历史记录URL 模板1',
'sfg_id' => 89,
'arrSubjectFomart' => [
'/history',
]
],
'SHUJIA_INFO_URL' => [
'description' => '书架URL 模板1',
'sfg_id' => 90,
'arrSubjectFomart' => [
'/bookshelf',
]
],
'USER_INFO_URL' => [
'description' => '用户中心URL 模板1',
'sfg_id' => 91,
'arrSubjectFomart' => [
'/user',
]
],
// SEO 丰富内容 // SEO 丰富内容
'INDEX_POPULAR_NOVELS' => [ 'INDEX_POPULAR_NOVELS' => [
@@ -723,7 +745,119 @@ class TemplateSeeder
] ]
], ],
// 最新id 88 // 历史记录
'HISTORY_INFO_URL_T2' => [
'description' => '历史记录URL 模板2',
'sfg_id' => 92,
'arrSubjectFomart' => [
'/reading-history',
]
],
'HISTORY_INFO_URL_T3' => [
'description' => '历史记录URL 模板3',
'sfg_id' => 93,
'arrSubjectFomart' => [
'/read-record',
]
],
'HISTORY_INFO_URL_T4' => [
'description' => '历史记录URL 模板4',
'sfg_id' => 94,
'arrSubjectFomart' => [
'/lishi',
]
],
'HISTORY_INFO_URL_T5' => [
'description' => '历史记录URL 模板5',
'sfg_id' => 95,
'arrSubjectFomart' => [
'/yuedu-lishi',
]
],
'HISTORY_INFO_URL_T6' => [
'description' => '历史记录URL 模板6',
'sfg_id' => 96,
'arrSubjectFomart' => [
'/browse-past',
]
],
// 历史记录
'SHUJIA_INFO_URL_T2' => [
'description' => '书架URL 模板2',
'sfg_id' => 97,
'arrSubjectFomart' => [
'/book-shelf',
]
],
'SHUJIA_INFO_URL_T3' => [
'description' => '书架URL 模板3',
'sfg_id' => 98,
'arrSubjectFomart' => [
'/reading-shelf',
]
],
'SHUJIA_INFO_URL_T4' => [
'description' => '书架URL 模板4',
'sfg_id' => 99,
'arrSubjectFomart' => [
'/shujia',
]
],
'SHUJIA_INFO_URL_T5' => [
'description' => '书架URL 模板5',
'sfg_id' => 100,
'arrSubjectFomart' => [
'/yuedu-shujia',
]
],
'SHUJIA_INFO_URL_T6' => [
'description' => '书架URL 模板6',
'sfg_id' => 101,
'arrSubjectFomart' => [
'/book-collection',
]
],
// 用户中心
'USER_INFO_URL_T2' => [
'description' => '用户中心URL 模板2',
'sfg_id' => 102,
'arrSubjectFomart' => [
'/my-account',
]
],
'USER_INFO_URL_T3' => [
'description' => '用户中心URL 模板3',
'sfg_id' => 103,
'arrSubjectFomart' => [
'/profile',
]
],
'USER_INFO_URL_T4' => [
'description' => '用户中心URL 模板4',
'sfg_id' => 104,
'arrSubjectFomart' => [
'/yonghu',
]
],
'USER_INFO_URL_T5' => [
'description' => '用户中心URL 模板5',
'sfg_id' => 105,
'arrSubjectFomart' => [
'/wode-zhongxin',
]
],
'USER_INFO_URL_T6' => [
'description' => '用户中心URL 模板6',
'sfg_id' => 106,
'arrSubjectFomart' => [
'/personal-center',
]
],
// 最新替换模板分组id 106
]; ];