28 lines
846 B
PHP
28 lines
846 B
PHP
<?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();
|
|
}
|
|
}
|
|
} |