From cd9f49977f6ca332bf574a8fefbd2f4e20a4eda4 Mon Sep 17 00:00:00 2001 From: sugar1569 Date: Sat, 25 May 2024 10:01:58 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E7=A8=8B=E5=BA=8F=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E3=80=91miss=20=E8=B7=AF=E7=94=B1=E6=B7=BB=E5=8A=A0=E6=B3=A8?= =?UTF-8?q?=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crmeb/route/route.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/crmeb/route/route.php b/crmeb/route/route.php index 503153644..2f4f53e77 100644 --- a/crmeb/route/route.php +++ b/crmeb/route/route.php @@ -1,31 +1,43 @@ pathinfo(); + // 如果路径为空,则设置应用名称为空字符串 if ($appRequest === null) { $appName = ''; } else { + // 将双斜杠替换为单斜杠 $appRequest = str_replace('//', '/', $appRequest); + // 获取应用名称 $appName = explode('/', $appRequest)[0] ?? ''; } switch (strtolower($appName)) { + // 如果应用名称为 admin、kefu 或 app,则返回对应的视图 case config('app.admin_prefix', 'admin'): case 'kefu': case 'app': return view(app()->getRootPath() . 'public' . DS . config('app.admin_prefix', 'admin') . DS . 'index.html'); + // 如果应用名称为 home,则根据请求类型返回不同的视图或重定向 case 'home': + // 如果是移动端访问 if (request()->isMobile()) { return redirect(app()->route->buildUrl('/')); } else { return view(app()->getRootPath() . 'public' . DS . 'home' . DS . 'index.html'); } + // 如果应用名称为 pages,则返回 index.html 视图 case 'pages': return view(app()->getRootPath() . 'public' . DS . 'index.html'); default: + // 如果不是移动端访问 if (!request()->isMobile()) { + // 如果请求类型为 PC,并且 home 目录存在且没有 mdType 参数,则返回 home/index.html 视图 if (is_dir(app()->getRootPath() . 'public' . DS . 'home') && !request()->get('mdType')) { return view(app()->getRootPath() . 'public' . DS . 'home' . DS . 'index.html'); } else {