更新功能
This commit is contained in:
28
app/middleware/AdminAuth.php
Normal file
28
app/middleware/AdminAuth.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\middleware;
|
||||
|
||||
use think\facade\View;
|
||||
use think\facade\Session;
|
||||
|
||||
/**
|
||||
* @title 后台中间件
|
||||
*/
|
||||
class AdminAuth {
|
||||
|
||||
public function handle($request, \Closure $next) {
|
||||
$user = Session::get('user');
|
||||
|
||||
if (Session::has('user') && $user['uid']) {
|
||||
return $next($request);
|
||||
}else{
|
||||
return redirect(url('admin.index/login'))->remember();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user