app.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. use think\facade\Route;
  3. Route::any('/index/all', "index/all");
  4. Route::any('/manager', 'index/index');
  5. Route::any("/privacy", "index/privacy");
  6. Route::any('/noteApp', "index/index");
  7. Route::any("/api/background$", "api/background");
  8. Route::any("/qq_login$", "user/qq_login");
  9. Route::any("/favicon", "index/favicon");
  10. Route::get("/plugins/:dir/static/[:file]", "\PluginStaticSystem@index")->pattern(['dir' => '\w+', 'file' => '[\w||\s\-].*']); //插件静态资源路由文件
  11. Route::any("/manifest.json", "index/manifest")->cache(60 * 10);
  12. Route::any("/searchEngine/searchEngine", "searchEngine/searchEngine");
  13. Route::get('/installApp', 'installApp/index');
  14. Route::any('/installApp/testDb', 'installApp/testDb');
  15. Route::any('/installApp/install', 'installApp/install');
  16. Route::group("/plugins", function () {
  17. $pluginsDir = root_path() . "plugins/";
  18. if (is_dir($pluginsDir)) {
  19. $url = request()->baseUrl();
  20. $urlArr = explode('/', $url);
  21. $pluginsDirName = '';
  22. if (isset($urlArr[2])) {
  23. $pluginsDirName = $urlArr[2];
  24. }
  25. foreach (scandir($pluginsDir) as $item) {
  26. if (mb_strtolower($item) == mb_strtolower($pluginsDirName)) {
  27. $router = $pluginsDir . $item . '/route.php';
  28. if (file_exists($router)) {
  29. $_ENV['plugins_dir_name'] = $pluginsDir . $item;
  30. include_once $router;
  31. break;
  32. }
  33. }
  34. }
  35. }
  36. Route::miss(function () {
  37. return view(app_path() . "view/cardNotFound.html")->code(200);
  38. });
  39. });
  40. Route::any('/', 'index/index');
  41. Route::options("[:s]", function () {
  42. return response('', 200);
  43. })->cache(60 * 60);