Skip to content

Commit

Permalink
移除跨域请求 由全局跨域控制
Browse files Browse the repository at this point in the history
  • Loading branch information
edenleung authored May 3, 2020
1 parent 276df4f commit e530309
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions app/admin/route/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,19 @@
return 'Hello,ThinkPHP6!';
});

Route::miss(function () {
return 'Miss Route!';
});

Route::group('/auth', function () {
Route::post('/login', 'auth/login');
Route::post('/logout', 'auth/logout');
Route::get('/refresh_token', 'auth/refreshToken');
})->allowCrossDomain();
});

// 规则
Route::group('/permission', function () {
Route::rule('/', 'system.permission/list', 'GET')->middleware(Permission::class, 'PermissionGet');
Route::rule('/', 'system.permission/add', 'POST')->middleware(Permission::class, 'PermissionAdd');
Route::rule('/:id', 'system.permission/renew', 'PUT')->middleware(Permission::class, 'PermissionUpdate');
Route::rule('/:id', 'system.permission/remove', 'DELETE')->middleware(Permission::class, 'PermissionDelete');
})->allowCrossDomain()->middleware(Jwt::class);
})->middleware(Jwt::class);

// 角色
Route::group('/role', function () {
Expand All @@ -49,7 +45,7 @@
Route::rule('/:id$', 'system.role/update', 'PUT')->middleware(Permission::class, 'RoleUpdate');
Route::rule('/:id$', 'system.role/delete', 'DELETE')->middleware(Permission::class, 'RoleDelete');
Route::rule('/:id/mode', 'system.role/mode', 'PUT');
})->allowCrossDomain()->middleware(Jwt::class);
})->middleware(Jwt::class);

// 用户
Route::group('/user', function () {
Expand All @@ -66,15 +62,15 @@
Route::rule('/info$', 'system.user/info', 'GET');
Route::rule('/:id', 'system.user/update', 'PUT')->middleware(Permission::class, 'AccountUpdate');
Route::rule('/:id', 'system.user/delete', 'DELETE')->middleware(Permission::class, 'AccountDelete');
})->allowCrossDomain()->middleware(Jwt::class);
})->middleware(Jwt::class);

// 日志
Route::group('/log', function () {
Route::rule('/acount', 'log.AccountLog/list', 'GET')->middleware(Permission::class, 'LogAccountGet');
Route::rule('/acount', 'log.AccountLog/delete', 'DELETE')->middleware(Permission::class, 'LogAccountDelete');
Route::rule('/db', 'log.DataBaseLog/list', 'GET')->middleware(Permission::class, 'LogDbGet');
Route::rule('/db', 'log.DataBaseLog/delete', 'DELETE')->middleware(Permission::class, 'LogDbDelete');
})->allowCrossDomain()->middleware(Jwt::class);
})->middleware(Jwt::class);

Route::group('/system', function () {
Route::rule('/dept', 'system.dept/list', 'GET')->middleware(Permission::class, 'DeptGet');
Expand All @@ -86,12 +82,12 @@
Route::rule('/post', 'system.post/add', 'POST')->middleware(Permission::class, 'PostAdd');
Route::rule('/post/:id', 'system.post/update', 'PUT')->middleware(Permission::class, 'PostUpdate');
Route::rule('/post/:id', 'system.post/delete', 'DELETE')->middleware(Permission::class, 'PostDelete');
})->allowCrossDomain()->middleware(Jwt::class);
})->middleware(Jwt::class);

// 模拟数据(可删除)
Route::group('/mock', function () {
Route::rule('/list/search/projects', 'mock/projects', 'GET');
Route::rule('/workplace/activity', 'mock/activity', 'GET');
Route::rule('/workplace/radar', 'mock/radar', 'GET');
Route::rule('/workplace/teams', 'mock/teams', 'GET');
})->allowCrossDomain();
});

0 comments on commit e530309

Please sign in to comment.