You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

zroute.php 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <?php
  2. use app\http\middleware\InstallMiddleware;
  3. use think\facade\Route;
  4. use think\Response;
  5. /**
  6. * 系统默认路由配置
  7. */
  8. Route::get('install/index', 'InstallController/index');//安装程序
  9. Route::post('install/index', 'InstallController/index');//安装程序
  10. Route::get('install/compiler', 'InstallController/swooleCompiler');//swooleCompiler安装提示
  11. Route::get('upgrade/index', 'UpgradeController/index');
  12. Route::get('up', 'UpgradeVersionController/index');
  13. Route::get('up/render', 'UpgradeVersionController/render');
  14. Route::get('upgrade/upgrade', 'UpgradeController/upgrade');
  15. Route::group('/', function () {
  16. Route::group('install', function () {
  17. Route::miss(function () {
  18. return view(app()->getRootPath() . 'public' . DS . 'install');
  19. });
  20. });
  21. Route::group('admin', function () {
  22. Route::miss(function () {
  23. $pathInfo = request()->pathinfo();
  24. $pathInfoArr = explode('/', $pathInfo);
  25. $admin = $pathInfoArr[0] ?? '';
  26. if ($admin === 'admin') {
  27. return view(app()->getRootPath() . 'public' . DS . 'admin' . DS . 'index.html');
  28. } else {
  29. return Response::create()->code(404);
  30. }
  31. });
  32. });
  33. Route::group('cashier', function () {
  34. Route::miss(function () {
  35. $pathInfo = request()->pathinfo();
  36. $pathInfoArr = explode('/', $pathInfo);
  37. $admin = $pathInfoArr[0] ?? '';
  38. if ('cashier' === $admin) {
  39. return view(app()->getRootPath() . 'public' . DS . 'cashier' . DS . 'index.html');
  40. } else {
  41. return Response::create()->code(404);
  42. }
  43. });
  44. });
  45. Route::group('kefu', function () {
  46. Route::miss(function () {
  47. $pathInfo = request()->pathinfo();
  48. $pathInfoArr = explode('/', $pathInfo);
  49. $admin = $pathInfoArr[0] ?? '';
  50. if ('kefu' === $admin) {
  51. return view(app()->getRootPath() . 'public' . DS . 'admin' . DS . 'index.html');
  52. } else {
  53. return Response::create()->code(404);
  54. }
  55. });
  56. });
  57. Route::group('pages', function () {
  58. Route::miss(function () {
  59. $pathInfo = request()->pathinfo();
  60. $pathInfoArr = explode('/', $pathInfo);
  61. $admin = $pathInfoArr[0] ?? '';
  62. if ('pages' === $admin) {
  63. return view(app()->getRootPath() . 'public' . DS . 'index.html');
  64. } else {
  65. return Response::create()->code(404);
  66. }
  67. });
  68. });
  69. Route::group('home', function () {
  70. Route::miss(function () {
  71. if (request()->isMobile()) {
  72. return redirect(app()->route->buildUrl('/'));
  73. } else {
  74. return view(app()->getRootPath() . 'public' . DS . 'home' . DS . 'index.html');
  75. }
  76. });
  77. });
  78. Route::group('store', function () {
  79. Route::miss(function () {
  80. $pathInfo = request()->pathinfo();
  81. $pathInfoArr = explode('/', $pathInfo);
  82. $admin = $pathInfoArr[0] ?? '';
  83. if ('store' === $admin) {
  84. return view(app()->getRootPath() . 'public' . DS . 'store' . DS . 'index.html');
  85. } else {
  86. return Response::create()->code(404);
  87. }
  88. });
  89. });
  90. Route::miss(function () {
  91. if (!request()->isMobile() && is_dir(app()->getRootPath() . 'public' . DS . 'home') && !request()->get('type')) {
  92. return view(app()->getRootPath() . 'public' . DS . 'home' . DS . 'index.html');
  93. } else {
  94. return view(app()->getRootPath() . 'public' . DS . 'index.html');
  95. }
  96. });
  97. })->middleware(InstallMiddleware::class);