refactor: 系统url

This commit is contained in:
2025-05-07 10:57:39 +08:00
parent bf7cc21156
commit 1b7fbded0a
2 changed files with 15 additions and 16 deletions

View File

@@ -101,14 +101,14 @@ class System
case 'article': case 'article':
$articles = $this->getArticleByCategory($lang_id, $param['id']); $articles = $this->getArticleByCategory($lang_id, $param['id']);
$urls = array_map(function($item) { $urls = array_map(function($item) {
$item['url'] = (string)url('yy/zz', ['id' => $item['id']]); $item['url'] = (string)url('/index/article/detail/' . $item['id']);
return $item; return $item;
}, $articles); }, $articles);
break; break;
case 'product': case 'product':
$products = $this->getProductByCategory($lang_id, $param['id']); $products = $this->getProductByCategory($lang_id, $param['id']);
$urls = array_map(function($item) { $urls = array_map(function($item) {
$item['url'] = (string)url('yy/zz', ['id' => $item['id']]); $item['url'] = (string)url('/index/product/detail/' . $item['id']);
return $item; return $item;
}, $products); }, $products);
break; break;
@@ -133,7 +133,7 @@ class System
'name' => '文章分类', 'name' => '文章分类',
'link_to' => 'article_category', 'link_to' => 'article_category',
'data' => array_to_tree(array_map(function($item) { 'data' => array_to_tree(array_map(function($item) {
$item['url'] = (string)url('yy/zz', ['id' => $item['id']]); $item['url'] = (string)url('/index/article/index/' . $item['id']);
return $item; return $item;
}, $article_category), 0, 'pid', false, false) }, $article_category), 0, 'pid', false, false)
], ],
@@ -146,7 +146,7 @@ class System
'name' => '产品分类', 'name' => '产品分类',
'link_to' => 'product_category', 'link_to' => 'product_category',
'data' => array_to_tree(array_map(function($item) { 'data' => array_to_tree(array_map(function($item) {
$item['url'] = (string)url('yy/zz', ['id' => $item['id']]); $item['url'] = (string)url('/index/product/category/' . $item['id']);
return $item; return $item;
}, $product_category), 0, 'pid', false, false) }, $product_category), 0, 'pid', false, false)
], ],
@@ -199,7 +199,6 @@ class System
]) ])
->language($lang_id) ->language($lang_id)
->category($category_id) ->category($category_id)
->enabled()
->select(); ->select();
return $data->toArray(); return $data->toArray();

View File

@@ -13,7 +13,7 @@ use think\facade\Route;
Route::get('/', 'Index/index'); Route::get('/', 'Index/index');
// 产品相关路由 // 产品相关路由
Route::group('product', function() { Route::group('product', function () {
// 产品分类页 // 产品分类页
Route::get('category/:id', 'Product/category'); Route::get('category/:id', 'Product/category');
// 产品详情页 // 产品详情页
@@ -27,7 +27,7 @@ Route::group('product', function() {
}); });
// 文章相关路由 // 文章相关路由
Route::group('article', function() { Route::group('article', function () {
// 文章列表页 // 文章列表页
Route::get('index/:pid', 'Article/index'); Route::get('index/:pid', 'Article/index');
// 文章详情页 // 文章详情页
@@ -39,7 +39,7 @@ Route::group('article', function() {
}); });
// 附件下载 // 附件下载
Route::group('attachment', function() { Route::group('attachment', function () {
// 软件驱动/手册 // 软件驱动/手册
Route::get('index', 'Attachment/index'); Route::get('index', 'Attachment/index');
// 视频 // 视频
@@ -47,13 +47,13 @@ Route::group('attachment', function() {
}); });
// 问答中心 // 问答中心
Route::group('faq', function() { Route::group('faq', function () {
// 问答列表页 // 问答列表页
Route::get('index', 'Faq/index'); Route::get('index', 'Faq/index');
}); });
// 关于我们 // 关于我们
Route::group('aboutus', function() { Route::group('aboutus', function () {
// 品牌介绍 // 品牌介绍
Route::get('introduction', 'AboutUs/introduction'); Route::get('introduction', 'AboutUs/introduction');
// 品牌故事 // 品牌故事
@@ -67,7 +67,7 @@ Route::group('aboutus', function() {
}); });
// 联系我们 // 联系我们
Route::group('contactus', function() { Route::group('contactus', function () {
// 联系我们 // 联系我们
Route::get('index', 'ContactUs/index'); Route::get('index', 'ContactUs/index');
// 留言联系我们 // 留言联系我们
@@ -85,9 +85,9 @@ Route::group('contactus', function() {
}); });
// 专题 // 专题
Route::group('topic', function() { Route::group('topic', function () {
// 专题-Nas // 专题-Nas
Route::group('nas', function() { Route::group('nas', function () {
// 专题-Nas首页 // 专题-Nas首页
Route::get('index', 'TopicNas/index'); Route::get('index', 'TopicNas/index');
// 专题-Nas产品体验页 // 专题-Nas产品体验页