57 lines
2.6 KiB
PHP
Executable File
57 lines
2.6 KiB
PHP
Executable File
<?php
|
|
// +----------------------------------------------------------------------
|
|
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
|
// +----------------------------------------------------------------------
|
|
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
|
|
// +----------------------------------------------------------------------
|
|
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
|
// +----------------------------------------------------------------------
|
|
// | Author: liu21st <liu21st@gmail.com>
|
|
// +----------------------------------------------------------------------
|
|
use think\facade\Route;
|
|
use app\services\module\ModuleService;
|
|
use app\services\system\RewriteService;
|
|
use app\http\middleware\Validate;
|
|
use app\http\middleware\Admin;
|
|
|
|
app()->make(ModuleService::class)->registerRoute(); //注册模型路由
|
|
app()->make(RewriteService::class)->registerRoute(); //后台伪静态设置路由注册
|
|
|
|
Route::rule('/', 'front.Index/index');
|
|
Route::rule('search', 'front.Content/search');
|
|
Route::rule('category', 'front.Content/category');
|
|
Route::rule('topic-:id', 'front.Content/topic');
|
|
Route::rule('form/:id/[:name]', 'front.Form/index');
|
|
Route::rule('front/:controller/:function', 'front.:controller/:function');
|
|
|
|
Route::group('admin', function () {
|
|
Route::rule('/', 'admin.Index/index');
|
|
Route::rule('login', 'admin.Index/login');
|
|
Route::rule('logout', 'admin.Index/logout');
|
|
Route::rule('upload/:function', 'admin.Upload/:function')->append(['from'=>'admin']);
|
|
Route::rule(':controller/:function', 'admin.:controller/:function');
|
|
});
|
|
|
|
Route::group('user', function () {
|
|
Route::rule('/', 'user.Index/index');
|
|
Route::rule('login', 'user.Index/login');
|
|
Route::rule('logout', 'user.Index/logout');
|
|
Route::rule('register', 'user.Index/register');
|
|
Route::rule('upload/:function', 'user.Upload/:function')->append(['from'=>'user']);
|
|
Route::rule(':controller/:function', 'user.:controller/:function');
|
|
});
|
|
|
|
Route::group('api', function () {
|
|
Route::rule('/', 'api.Index/index');
|
|
Route::rule('login', 'api.Login/index');
|
|
Route::rule('register', 'api.Login/register');
|
|
Route::rule('logout', 'api.Login/logout');
|
|
Route::rule('upload/:function', 'Upload/:function')->append(['from'=>'api']);
|
|
Route::rule(':controller/:function', 'api.:controller/:function');
|
|
})->allowCrossDomain([
|
|
'Access-Control-Allow-Origin' => '*',
|
|
'Access-Control-Allow-Credentials' => 'true',
|
|
'Access-Control-Allow-Headers' => 'authorization, token, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, X-Requested-With',
|
|
]);
|
|
|
|
Route::miss('front.Index/miss'); |