114 lines
3.9 KiB
PHP
114 lines
3.9 KiB
PHP
<?php
|
|
|
|
use app\http\middleware\InstallMiddleware;
|
|
use think\facade\Route;
|
|
use think\Response;
|
|
|
|
/**
|
|
* 系统默认路由配置
|
|
*/
|
|
Route::get('install/index', 'Install/index');//安装程序
|
|
Route::post('install/index', 'Install/index');//安装程序
|
|
Route::get('install/compiler', 'Install/swooleCompiler');//swooleCompiler安装提示
|
|
Route::get('upgrade/index', 'Upgrade/index');
|
|
Route::get('upgrade/upgrade', 'Upgrade/upgrade');
|
|
Route::get('upgrade/transfer', 'Upgrade/transfer');
|
|
Route::post('upgrade/upgrade_transfer', 'Upgrade/upgrade_transfer');
|
|
|
|
Route::group('/', function () {
|
|
Route::group('install', function () {
|
|
Route::miss(function () {
|
|
return view(app()->getRootPath() . 'public' . DS . 'install');
|
|
});
|
|
});
|
|
|
|
Route::group('admin', function () {
|
|
Route::miss(function () {
|
|
$pathInfo = request()->pathinfo();
|
|
$pathInfoArr = explode('/', $pathInfo);
|
|
$admin = $pathInfoArr[0] ?? '';
|
|
if ($admin === 'admin') {
|
|
return __view(app()->getRootPath() . 'public' . DS . 'admin' . DS . 'index.html');
|
|
} else {
|
|
return Response::create()->code(404);
|
|
}
|
|
});
|
|
});
|
|
|
|
//扫码上传
|
|
Route::group('app', function () {
|
|
Route::miss(function () {
|
|
$pathInfo = request()->pathinfo();
|
|
$pathInfoArr = explode('/', $pathInfo);
|
|
$admin = $pathInfoArr[0] ?? '';
|
|
if ($admin === 'app') {
|
|
return view(app()->getRootPath() . 'public' . DS . 'admin' . DS . 'index.html');
|
|
} else {
|
|
return Response::create()->code(404);
|
|
}
|
|
});
|
|
});
|
|
|
|
Route::group('kefu', function () {
|
|
Route::miss(function () {
|
|
$pathInfo = request()->pathinfo();
|
|
$pathInfoArr = explode('/', $pathInfo);
|
|
$admin = $pathInfoArr[0] ?? '';
|
|
if ('kefu' === $admin) {
|
|
return __view(app()->getRootPath() . 'public' . DS . 'admin' . DS . 'index.html');
|
|
} else {
|
|
return Response::create()->code(404);
|
|
}
|
|
});
|
|
});
|
|
|
|
Route::group('pages', function () {
|
|
Route::miss(function () {
|
|
$pathInfo = request()->pathinfo();
|
|
$pathInfoArr = explode('/', $pathInfo);
|
|
$admin = $pathInfoArr[0] ?? '';
|
|
if ('pages' === $admin) {
|
|
return view(app()->getRootPath() . 'public' . DS . 'index.html');
|
|
} else {
|
|
return Response::create()->code(404);
|
|
}
|
|
});
|
|
});
|
|
|
|
Route::group('home', function () {
|
|
Route::miss(function () {
|
|
if (request()->isMobile()) {
|
|
return redirect(app()->route->buildUrl('/'));
|
|
} else {
|
|
return view(app()->getRootPath() . 'public' . DS . 'home' . DS . 'index.html');
|
|
}
|
|
});
|
|
});
|
|
|
|
Route::group('supplier', function () {
|
|
Route::miss(function () {
|
|
$pathInfo = request()->pathinfo();
|
|
$pathInfoArr = explode('/', $pathInfo);
|
|
$admin = $pathInfoArr[0] ?? '';
|
|
if ('supplier' === $admin) {
|
|
return __view(app()->getRootPath() . 'public' . DS . 'admin' . DS . 'index.html');
|
|
} else {
|
|
return Response::create()->code(404);
|
|
}
|
|
});
|
|
});
|
|
|
|
Route::miss(function () {
|
|
if (!request()->isMobile() && is_dir(app()->getRootPath() . 'public' . DS . 'home') && !request()->get('type')) {
|
|
if (file_exists(app()->getRootPath() . 'public' . DS . 'home' . DS . 'index.html')) {
|
|
return view(app()->getRootPath() . 'public' . DS . 'home' . DS . 'index.html');
|
|
} else {
|
|
return view(app()->getRootPath() . 'public' . DS . 'index.html');
|
|
}
|
|
} else {
|
|
return view(app()->getRootPath() . 'public' . DS . 'index.html');
|
|
}
|
|
});
|
|
|
|
})->middleware(InstallMiddleware::class);
|