route.php 1.4 KB

123456789101112131415161718192021222324252627282930
  1. <?php
  2. use think\facade\Route;
  3. use think\facade\Config;
  4. use think\Response;
  5. Route::group(function () {
  6. Route::get('index', 'PublicController/index')->name('index');//首页
  7. Route::get('page/:unique', 'PublicController/page')->name('pageDetail');//单页详情
  8. Route::get('group_data/:name', 'PublicController/group_data')->name('groupData');//组合数据
  9. //机构
  10. Route::get('organ/list', 'auti.CourseController/organList')->name('organList');//机构列表
  11. Route::get('organ/detail/:id', 'auti.CourseController/organ')->name('organDetail');//机构详情
  12. //课程
  13. Route::get('course/list', 'auti.CourseController/list')->name('courseList');//课程列表
  14. Route::get('course/detail/:id', 'auti.CourseController/detail')->name('courseDetail');//课程详情
  15. //相关知识
  16. Route::get('article/list', 'auti.ArticleController/list')->name('articleList');//文章列表
  17. Route::get('article/detail/:id', 'auti.ArticleController/detail')->name('articleDetail');//文章详情
  18. })->middleware(\app\http\middleware\AllowOriginMiddleware::class);
  19. Route::miss(function () {
  20. if (app()->request->isOptions()) {
  21. $header = Config::get('cookie.header');
  22. unset($header['Access-Control-Allow-Credentials']);
  23. return Response::create('ok')->code(200)->header($header);
  24. } else
  25. return Response::create()->code(404);
  26. });