route.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. namespace app\system\route;
  3. use app\system\middleware\AllowOriginMiddleware;
  4. use think\facade\Config;
  5. use think\facade\Route;
  6. use think\Response;
  7. /**
  8. * 无需授权的接口
  9. */
  10. Route::group(function () {
  11. //后台管理员登录
  12. Route::rule('login/login', 'Login/index');
  13. Route::rule('login/logut', 'Login/logut');
  14. //验证码
  15. Route::get('login/captcha', 'Login/captcha');
  16. //
  17. Route::rule('index', 'Index/index');
  18. //获取area
  19. Route::rule('pub/getArea', 'pub/getArea');
  20. //绑定登录
  21. Route::rule('login/system_bind','Login/system_bind');
  22. //绑定登录数据
  23. Route::rule('login/system_bind_data','Login/system_bind_data');
  24. //绑定成功
  25. Route::rule('login/bindsuccess','Login/bindsuccess');
  26. })->middleware(AllowOriginMiddleware::class);
  27. /**
  28. * miss 路由
  29. */
  30. Route::miss(function () {
  31. if (app()->request->isOptions()) {
  32. $header = Config::get('cookie.header');
  33. $header['Access-Control-Allow-Origin'] = app()->request->header('origin');
  34. return Response::create('ok')->code(200)->header($header);
  35. } else
  36. return Response::create()->code(404);
  37. });