From 32d591d1084bfddde0c7964e27b37619e9b06776 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=A8=E6=A0=88=E5=B0=8F=E5=AD=A6=E7=94=9F?= <1518079521@qq.com> Date: Sat, 20 May 2023 18:32:23 +0800 Subject: [PATCH] Update app.php --- niucloud/route/app.php | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/niucloud/route/app.php b/niucloud/route/app.php index c17b09e67..8bcc537a8 100644 --- a/niucloud/route/app.php +++ b/niucloud/route/app.php @@ -1,10 +1,24 @@ +// +---------------------------------------------------------------------- use think\facade\Route; +use think\facade\Request; + Route::domain('install.php', ':\app\install\controller'); // 访问首页自动跳转到admin Route::rule('/', function () { - return redirect('/web'); + if (Request::isMobile()) { + return redirect('/wap'); + } else { + return redirect('/web'); + } }); // 管理后台 Route::rule('admin/:any', function () { @@ -14,11 +28,11 @@ Route::rule('admin/:any', function () { Route::rule('wap/:any', function () { return view(app()->getRootPath() . 'public/wap/index.html'); })->pattern(['any' => '\w+']); -// 手机端 +// 电脑端 Route::rule('web/:any', function () { return view(app()->getRootPath() . 'public/web/index.html'); })->pattern(['any' => '\w+']); //用于公众号授权证书 Route::any('MP_verify_.txt', function ($name) { echo $name; -}); +}); \ No newline at end of file