设计url

This commit is contained in:
make
2025-03-30 16:56:15 +08:00
14 changed files with 343 additions and 266 deletions

View File

@@ -2,63 +2,80 @@
declare(strict_types=1);
use app\home\controller\Index;
use app\home\controller\Novel;
use app\home\controller\User;
use think\facade\Route;
# 路由别名,可以忽略
// Route::alias("/index.html", "/")->append(['boolIsMobile' => true]);
// Route::alias("/pc/index.html", "/")->append(['boolIsMobile' => false]);
Route::get("/", 'Index/index')->ext('html')->append(['boolIsMobile' => true]);
Route::get("/index", 'Index/index')->ext('html')->append(['boolIsMobile' => true]);
Route::get("/pc/index", 'Index/getPcIndex')->ext('html')->append(['boolIsMobile' => false]);
Route::get("/pc/", 'Index/getPcIndex')->append(['boolIsMobile' => false]);
Route::get("/", [Index::class,'index'])->ext('html')->append(['boolIsMobile' => true]);
Route::get("/index", [Index::class,'index'])->ext('html')->append(['boolIsMobile' => true]);
Route::get("/pc/index", [Index::class,'getPcIndex'])->ext('html')->append(['boolIsMobile' => false]);
Route::get("/pc/", [Index::class,'getPcIndex'])->append(['boolIsMobile' => false]);
// 书架
Route::get('bookshelf', 'User/getBookShelf')->ext('html')->append(['boolIsMobile' => true]);
Route::get('/pc/bookshelf', 'User/getBookShelf')->ext('html')->append(['boolIsMobile' => false]);
Route::get('bookshelf', [User::class,'getBookShelf'])->ext('html')->append(['boolIsMobile' => true]);
Route::get('/pc/bookshelf', [User::class,'getBookShelf'])->ext('html')->append(['boolIsMobile' => false]);
//排行榜
Route::get('rank', 'Novel/getNovelRank')->ext('html')->append(['boolIsMobile' => true]);
Route::get("/pc/rank", 'Novel/getNovelRank')->ext('html')->append(['boolIsMobile' => false]);
Route::get('paihang', [Novel::class,'getNovelRank'])->append(['boolIsMobile' => true]);
Route::get("/pc/paihang", [Novel::class,'getNovelRank'])->append(['boolIsMobile' => false]);
// 男生/女生-grok 推荐最优方案
Route::get('nansheng-xiaoshuo', [Novel::class, 'getNovelChannel'])->append(['boolIsMobile' => true, 'strChannel' => 'girls']);
Route::get('pc/nvsheng-xiaoshuo', [Novel::class, 'getNovelgetNovelChannelInfo'])->append(['boolIsMobile' => false, 'strChannel' => 'girls']);
// 男生/女生 - grok 推荐最优方案
Route::get('/nansheng-xiaoshuo', [Novel::class, 'getNovelChannel'])->append(['boolIsMobile' => true, 'strChannel' => 'boys']);
Route::get('/nvsheng-xiaoshuo', [Novel::class, 'getNovelChannel'])->append(['boolIsMobile' => false, 'strChannel' => 'girls']);
Route::get('/pc/nansheng-xiaoshuo', [Novel::class, 'getNovelChannel'])->append(['boolIsMobile' => false, 'strChannel' => 'boys']);
Route::get('/pc/nvsheng-xiaoshuo', [Novel::class, 'getNovelChannel'])->append(['boolIsMobile' => false, 'strChannel' => 'girls']);
// 书库 - grok 推荐最优方案 /shuku/channel-category-status-page
Route::get('/shuku/all', [Novel::class,'getLibrary'])->append(['boolIsMobile' => true]);
Route::get('/pc/shuku/all', [Novel::class,'getLibrary'])->append(['boolIsMobile' => false]);
Route::get('/shuku/:strNovelChannel-:strCategory-:strStatus-:intPage', [Novel::class,'getLibrary'])
->pattern([
'strNovelChannel' => '[\w]*',
'strCategory' => '[\w]*',
'strStatus' => '[\w]*',
'intPage' => '\d+'
])
->append(['boolIsMobile' => true]);
Route::get('/pc/shuku/:strNovelChannel-:strCategory-:strStatus-:intPage', [Novel::class,'getLibrary'])
->pattern([
'strNovelChannel' => '[\w]*',
'strCategory' => '[\w]*',
'strStatus' => '[\w]*',
'intPage' => '\d+'
])
->append(['boolIsMobile' => false]);
//分类
Route::get('class', 'Novel/getNovelCategory')->ext('html')->append(['boolIsMobile' => true]);
Route::get('/pc/class', 'Novel/getNovelCategory')->ext('html')->append(['boolIsMobile' => false]);
// //分类 使用模板:xmttxs
// Route::get('/books', 'Novel/getNovelCategory')->ext('html')->append(['boolIsMobile' => true]);
// Route::get('/pc/books', 'Novel/getNovelCategory')->ext('html')->append(['boolIsMobile' => false]);
// Route::get('/books/[:intCategoryId]-[:intPage]', 'Novel/getNovelCategory')->ext('html')->append(['boolIsMobile' => true]);
Route::get('/pc/fenlei/<intCategoryId]-[:intPage]', 'Novel/getNovelCategory')
->append(['boolIsMobile' => false])
->pattern(['intCategoryId' => '\d+','intPage' => '\d+',])
->ext('html');
// Route::get('class', 'Novel/getNovelCategory')->ext('html')->append(['boolIsMobile' => true]);
// Route::get('/pc/class', 'Novel/getNovelCategory')->ext('html')->append(['boolIsMobile' => false]);
// // //分类 使用模板:xmttxs
// // Route::get('/books', 'Novel/getNovelCategory')->ext('html')->append(['boolIsMobile' => true]);
// // Route::get('/pc/books', 'Novel/getNovelCategory')->ext('html')->append(['boolIsMobile' => false]);
// // Route::get('/books/[:intCategoryId]-[:intPage]', 'Novel/getNovelCategory')->ext('html')->append(['boolIsMobile' => true]);
// Route::get('/pc/fenlei/<intCategoryId]-[:intPage]', 'Novel/getNovelCategory')
// ->append(['boolIsMobile' => false])
// ->pattern(['intCategoryId' => '\d+','intPage' => '\d+',])
// ->ext('html');
// 书库
Route::get('/library', 'Novel/getLibrary')->ext('html')->append(['boolIsMobile' => true]);
Route::get("/pc/library", 'Novel/getLibrary')->ext('html')->append(['boolIsMobile' => false]);
Route::get('/shuku', 'Novel/getLibrary')->ext('html')->append(['boolIsMobile' => true]);
Route::get('/pc/shuku', 'Novel/getLibrary')->ext('html')->append(['boolIsMobile' => false]);
Route::get('/shuku/[:strNovelChannel]-[:intCategoryId]-[:strStatus]-[:intPage]', 'Novel/getLibrary')->ext('html')->append(['boolIsMobile' => true]);
Route::get('/pc/shuku/[:strNovelChannel]-[:intCategoryId]-[:strStatus]-[:intPage]', 'Novel/getLibrary')->ext('html')->append(['boolIsMobile' => false]);
// 文章 列表
Route::get('/article/list-[:intCategoryId]-[:intPage]', 'Novel/getArticleList')->ext('html')->append(['boolIsMobile' => true]);
Route::get('/pc/article/list-[:intCategoryId]-[:intPage]', 'Novel/getArticleList')->ext('html')->append(['boolIsMobile' => false]);
Route::get('/article/list', 'Novel/getArticleList')->ext('html')->append(['boolIsMobile' => true]);
Route::get('/pc/article/list', 'Novel/getArticleList')->ext('html')->append(['boolIsMobile' => false]);
Route::get('/article/list-[:intCategoryId]-[:intPage]', [Novel::class,'getArticleList'])->ext('html')->append(['boolIsMobile' => true]);
Route::get('/pc/article/list-[:intCategoryId]-[:intPage]', [Novel::class,'getArticleList'])->ext('html')->append(['boolIsMobile' => false]);
Route::get('/article/list', [Novel::class,'getArticleList'])->ext('html')->append(['boolIsMobile' => true]);
Route::get('/pc/article/list', [Novel::class,'getArticleList'])->ext('html')->append(['boolIsMobile' => false]);
// 文章 详情
Route::get('/article/info-:intArticleId', 'Novel/getArticleInfo')->ext('html')->append(['boolIsMobile' => true]);
Route::get('/pc/article/info-:intArticleId', 'Novel/getArticleInfo')->ext('html')->append(['boolIsMobile' => false]);
Route::get('/article/info-:intArticleId', [Novel::class,'getArticleInfo'])->ext('html')->append(['boolIsMobile' => true]);
Route::get('/pc/article/info-:intArticleId', [Novel::class,'getArticleInfo'])->ext('html')->append(['boolIsMobile' => false]);
// 小说详情
@@ -103,23 +120,23 @@ Route::get('/pc/chapter/:intNovelId-:intChapterId-[:intChapterPage]', 'Novel/get
Route::get('/pc/books/:intNovelId-:intChapterId-[:intChapterPage]', 'Novel/getNovelChapter')->ext('html')->append(['boolIsMobile' => false]);
// 小说目录
Route::get('/chapters/:intNovelId-[:intPage]-[:strSort]', 'Novel/getNovelChapterAll')->ext('html')->append(['boolIsMobile' => true]);
Route::get('pc/chapters/:intNovelId-[:intPage]-[:strSort]', 'Novel/getNovelChapterAll')->ext('html')->append(['boolIsMobile' => false]);
Route::get('/chapters', 'Novel/getNovelChapterAll')->ext('html')->append(['boolIsMobile' => true]);
Route::get('pc/chapters', 'Novel/getNovelChapterAll')->ext('html')->append(['boolIsMobile' => false]);
Route::get('/chapters/:intNovelId-[:intPage]-[:strSort]', [Novel::class,'getNovelChapterAll'])->ext('html')->append(['boolIsMobile' => true]);
Route::get('pc/chapters/:intNovelId-[:intPage]-[:strSort]', [Novel::class,'getNovelChapterAll'])->ext('html')->append(['boolIsMobile' => false]);
Route::get('/chapters', [Novel::class,'getNovelChapterAll'])->ext('html')->append(['boolIsMobile' => true]);
Route::get('pc/chapters', [Novel::class,'getNovelChapterAll'])->ext('html')->append(['boolIsMobile' => false]);
// 搜索小说
Route::get('search', 'Novel/getSearchNovel')->ext('html')->append(['boolIsMobile' => true]);
Route::get('pc/search', 'Novel/getSearchNovel')->ext('html')->append(['boolIsMobile' => false]);
Route::get('search', [Novel::class,'getSearchNovel'])->ext('html')->append(['boolIsMobile' => true]);
Route::get('pc/search', [Novel::class,'getSearchNovel'])->ext('html')->append(['boolIsMobile' => false]);
// 小说用户中心
Route::get('/user', 'User/Index')->ext('html')->append(['boolIsMobile' => true]);
Route::get('/pc/user', 'User/Index')->ext('html')->append(['boolIsMobile' => false]);
Route::get('/user', [User::class,'Index'])->ext('html')->append(['boolIsMobile' => true]);
Route::get('/pc/user', [User::class,'Index'])->ext('html')->append(['boolIsMobile' => false]);
// 历史记录
Route::get('history', 'User/getHistory')->ext('html')->append(['boolIsMobile' => true]);
Route::get('/pc/history', 'User/getHistory')->ext('html')->append(['boolIsMobile' => false]);
Route::get('history', [User::class,'getHistory'])->ext('html')->append(['boolIsMobile' => true]);
Route::get('/pc/history', [User::class,'getHistory'])->ext('html')->append(['boolIsMobile' => false]);
@@ -154,112 +171,112 @@ Route::get('/pc/history', 'User/getHistory')->ext('html')->append(['boolIsMobile
// $arrRoutes = [
// # 小说推荐
// [
// 'class'=>'Novel/getRankList',
// 'class'=>[Novel::class,'getRankList'],
// 'name'=>'Novel@getTuijianList',
// 'path'=>[
// '/tj/:intTjdj-[:intPage]',
// '/tuijian/:intTjdj-[:intPage]',
// '/recommend/:intTjdj-[:intPage]',
// '/nice/:intTjdj-[:intPage]',
// '/good/:intTjdj-[:intPage]',
// '/推荐/:intTjdj-[:intPage]',
// [::class,'tj/:intTjdj-[:intPage]'],
// [::class,'tuijian/:intTjdj-[:intPage]'],
// [::class,'recommend/:intTjdj-[:intPage]'],
// [::class,'nice/:intTjdj-[:intPage]'],
// [::class,'good/:intTjdj-[:intPage]'],
// [::class,'推荐/:intTjdj-[:intPage]'],
// ],
// ],
// # 小说分类
// [
// 'class'=>'Novel/getCategoryList',
// 'class'=>[Novel::class,'getCategoryList'],
// 'name'=>'Novel@getCategoryList',
// 'path'=>[
// '/list/:intCId-:intSort-:intStatus-[:intPage]',
// '/fenlei/:intCId-:intSort-:intStatus-[:intPage]',
// '/class/:intCId-:intSort-:intStatus-[:intPage]',
// '/type/:intCId-:intSort-:intStatus-[:intPage]',
// '/leixin/:intCId-:intSort-:intStatus-[:intPage]',
// '/小说分类/:intCId-:intSort-:intStatus-[:intPage]',
// [::class,'list/:intCId-:intSort-:intStatus-[:intPage]'],
// [::class,'fenlei/:intCId-:intSort-:intStatus-[:intPage]'],
// [::class,'class/:intCId-:intSort-:intStatus-[:intPage]'],
// [::class,'type/:intCId-:intSort-:intStatus-[:intPage]'],
// [::class,'leixin/:intCId-:intSort-:intStatus-[:intPage]'],
// [::class,'小说分类/:intCId-:intSort-:intStatus-[:intPage]'],
// ],
// ],
// # 小说排行
// [
// 'class'=>'Novel/getNovelRankList',
// 'class'=>[Novel::class,'getNovelRankList'],
// 'name'=>'Novel@getNovelRankList',
// 'path'=>[
// '/paihang/:intCId-:intSort-[:intPage]',
// '/paihanbang/:intCId-:intSort-[:intPage]',
// '/rank/:intCId-:intSort-[:intPage]',
// '/sort/:intCId-:intSort-[:intPage]',
// '/pb/:intCId-:intSort-[:intPage]',
// '/排行榜/:intCId-:intSort-[:intPage]',
// [::class,'paihang/:intCId-:intSort-[:intPage]'],
// [::class,'paihanbang/:intCId-:intSort-[:intPage]'],
// [::class,'rank/:intCId-:intSort-[:intPage]'],
// [::class,'sort/:intCId-:intSort-[:intPage]'],
// [::class,'pb/:intCId-:intSort-[:intPage]'],
// [::class,'排行榜/:intCId-:intSort-[:intPage]'],
// ],
// ],
// # 小说章节
// [
// 'class'=>'Novel/getReader',
// 'class'=>[Novel::class,'getReader'],
// 'name'=>'Novel@getReader',
// 'path'=>[
// '/xq/:intNovelId/:intZhangJiePaiXu-[:strSort]',
// '/xiaoshuo/:intNovelId/:intZhangJiePaiXu-[:strSort]',
// '/novel/:intNovelId/:intZhangJiePaiXu-[:strSort]',
// '/info/:intNovelId/:intZhangJiePaiXu-[:strSort]',
// '/shu/:intNovelId/:intZhangJiePaiXu-[:strSort]',
// '/小说/:intNovelId/:intZhangJiePaiXu-[:strSort]',
// [::class,'xq/:intNovelId/:intZhangJiePaiXu-[:strSort]'],
// [::class,'xiaoshuo/:intNovelId/:intZhangJiePaiXu-[:strSort]'],
// [::class,'novel/:intNovelId/:intZhangJiePaiXu-[:strSort]'],
// [::class,'info/:intNovelId/:intZhangJiePaiXu-[:strSort]'],
// [::class,'shu/:intNovelId/:intZhangJiePaiXu-[:strSort]'],
// [::class,'小说/:intNovelId/:intZhangJiePaiXu-[:strSort]'],
// '/book/:intNovelId/:intZhangJiePaiXu-[:strSort]',
// '/kan/:intNovelId/:intZhangJiePaiXu-[:strSort]',
// '/show/:intNovelId/:intZhangJiePaiXu-[:strSort]',
// '/yuedu/:intNovelId/:intZhangJiePaiXu-[:strSort]',
// '/see/:intNovelId/:intZhangJiePaiXu-[:strSort]',
// '/相关/:intNovelId/:intZhangJiePaiXu-[:strSort]',
// [::class,'book/:intNovelId/:intZhangJiePaiXu-[:strSort]'],
// [::class,'kan/:intNovelId/:intZhangJiePaiXu-[:strSort]'],
// [::class,'show/:intNovelId/:intZhangJiePaiXu-[:strSort]'],
// [::class,'yuedu/:intNovelId/:intZhangJiePaiXu-[:strSort]'],
// [::class,'see/:intNovelId/:intZhangJiePaiXu-[:strSort]'],
// [::class,'相关/:intNovelId/:intZhangJiePaiXu-[:strSort]'],
// ],
// ],
// # 小说详情
// [
// 'class'=>'Novel/getDetail',
// 'class'=>[Novel::class,'getDetail'],
// 'name'=>'Novel@getDetail',
// 'path'=>[
// '/xq/:intNovelId-[:intCurrentPage]-[:strSort]',
// '/xiaoshuo/:intNovelId-[:intCurrentPage]-[:strSort]',
// '/novel/:intNovelId-[:intCurrentPage]-[:strSort]',
// '/info/:intNovelId-[:intCurrentPage]-[:strSort]',
// '/shu/:intNovelId-[:intCurrentPage]-[:strSort]',
// '/小说/:intNovelId-[:intCurrentPage]-[:strSort]',
// [::class,'xq/:intNovelId-[:intCurrentPage]-[:strSort]'],
// [::class,'xiaoshuo/:intNovelId-[:intCurrentPage]-[:strSort]'],
// [::class,'novel/:intNovelId-[:intCurrentPage]-[:strSort]'],
// [::class,'info/:intNovelId-[:intCurrentPage]-[:strSort]'],
// [::class,'shu/:intNovelId-[:intCurrentPage]-[:strSort]'],
// [::class,'小说/:intNovelId-[:intCurrentPage]-[:strSort]'],
// '/book/:intNovelId-[:intCurrentPage]-[:strSort]',
// '/kan/:intNovelId-[:intCurrentPage]-[:strSort]',
// '/show/:intNovelId-[:intCurrentPage]-[:strSort]',
// '/yuedu/:intNovelId-[:intCurrentPage]-[:strSort]',
// '/see/:intNovelId-[:intCurrentPage]-[:strSort]',
// '/相关/:intNovelId-[:intCurrentPage]-[:strSort]',
// [::class,'book/:intNovelId-[:intCurrentPage]-[:strSort]'],
// [::class,'kan/:intNovelId-[:intCurrentPage]-[:strSort]'],
// [::class,'show/:intNovelId-[:intCurrentPage]-[:strSort]'],
// [::class,'yuedu/:intNovelId-[:intCurrentPage]-[:strSort]'],
// [::class,'see/:intNovelId-[:intCurrentPage]-[:strSort]'],
// [::class,'相关/:intNovelId-[:intCurrentPage]-[:strSort]'],
// ],
// ],
// # 搜索 - 小说
// [
// 'class'=>'Search/getNovel',
// [class'=>'Search::class,'getNovel'],
// 'name'=>'Search@getNovel',
// 'path'=>[
// '/search',
// [::class,'search'],
// ],
// ],
// # 书架
// [
// 'class'=>'Search/getShujia',
// 'name'=>'Search/getShujia',
// [class'=>'Search::class,'getShujia'],
// [name'=>'Search::class,'getShujia'],
// 'path'=>[
// '/shujia',
// [::class,'shujia'],
// ],
// ],
// # 收藏
// [
// 'class'=>'Search/addSc',
// 'name'=>'Search/addSc',
// [class'=>'Search::class,'addSc'],
// [name'=>'Search::class,'addSc'],
// 'path'=>[
// '/sc',
// [::class,'sc'],
// ],
// ],
// ];
// // Route::get('/sc', 'Novel/addSc')
// // Route::get('/sc', [Novel::class,'addSc'])
// // ->middleware('Throttle:5,60') // 限制 1 分钟内最多 5 次
// // ->name('Novel@addSc');