|
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
use think\Route;
use app\admin\model\Category as CategoryModel;
use app\admin\model\SysMenu as SysMenuModel;
Route::pattern([
'name' => '\w+',
'id' => '\d+',
'cid' => '\d+',
'page' => '\d+',
'year' => '\d+',
'month' => '\d+',
]);
// 首页
Route::get('/','index');
Route::get('index','index/index/index');
Route::get('challengeswesolve','index/index/challengeswesolve');
// 登录
Route::get('admin/login','admin/login/index');
Route::post('admin/login/login','admin/login/dologin');
Route::get('admin/login/logout','admin/login/logout');
// 后台首页
Route::get('admin/index/index','admin/index/index');
Route::get('admin/index','admin/index/index');
Route::get('admin','admin/index/index');
Route::get('admin/index/usedspace','admin/index/usedspace');
Route::post('admin/index/clearcache','admin/index/clearcache');
// 文件上传
Route::post('admin/file_manager/uploadimg','admin/file_manager/uploadimg');
Route::post('admin/file_manager/upload','admin/file_manager/upload');
// index 模块路由
$categoryModel = new CategoryModel();
$categoryList = $categoryModel->field('id,pid,name,tablename,url,type')->where('is_del', 0)->select();
foreach ($categoryList as $key => $value) {
// var_dump($value->toArray());
if ($value->type==2) {
Route::get($value->url,'index/index/'.$value->url);
} elseif($value->type==1) {
Route::get($value->url,'index/'.$value->tablename.'/index?cid='.$value->id);
} else {
Route::get($value->url.'/:id','index/'.$value->tablename.'/detail?cid='.$value->id);
Route::get($value->url,'index/'.$value->tablename.'/index?cid='.$value->id);
}
}
// exit;
/* Archive 归档 */
Route::get('/:year/:month','index/article/archive');
/* Author */
Route::get('/author/:name','index/article/author');
/* Tags */
Route::get('/tags/:name','index/article/tags');
/* 临时路由 */
Route::get('/aerospace','index/index/aerospace');
Route::get('/becomeareseller','index/index/becomeareseller');
Route::get('/f120','index/index/f120');
Route::get('/fdm','index/index/fdm');
Route::get('/pps','index/index/pps');
Route::get('/materials','index/index/materials');
Route::get('/challengeswesolve','index/index/challengeswesolve');
Route::get('/automotive','index/index/automotive');
Route::get('/industry/cladding','index/index/automotive');
Route::get('/industry/abrasion','index/index/automotive');
Route::get('/industry/spray','index/index/automotive');
Route::get('/industry/surface','index/index/automotive');
Route::get('/product/abrasion','index/index/materials');
Route::get('/product/spraying','index/index/fdm');
Route::get('/product/surface','index/index/f120');
Route::get('/product/modelwall','index/index/materials');
Route::get('/product/cladding','index/index/materials');
// Route::get('/resources/news','index/index/news');
// Route::get('information','index/index/information');
Route::get('/resources/vedio','index/index/vedio');
Route::get('/resources/download','index/index/download');
Route::get('/pps/modelwall','index/index/pps');
Route::get('/pps/abrasion','index/index/pps');
Route::get('/pps/cladding','index/index/pps');
// admin 模块路由
$sysMenuModel = new SysMenuModel();
$sysMenuList = $sysMenuModel->field('id, pid, name, url, type, icon')->select();
foreach ($sysMenuList as $key => $value) {
// var_dump($value->toArray());
if ($value->type==1) {
Route::get($value->url,$value->url);
} elseif($value->type==2) {
Route::rule($value->url,$value->url);
}
}
// exit;
// Route::get('contactus','index/base/contactus');
// Route::get('news/:id','index/article/detail?cid=3');
// Route::get('news','index/article/index?cid=3');
// Route::get('case/:id','index/article/detail?cid=4');
// Route::get('case','index/article/index?cid=4');
// Route::get('honour/:id','index/article/detail?cid=5');
// Route::get('honour','index/article/index?cid=5');
// Route::get('product/:id','index/article/detail?cid=2');
// Route::get('product','index/article/index?cid=2');
|