mirror of
https://github.com/flucont/btcloud.git
synced 2025-01-23 05:08:14 -05:00
20 lines
430 B
PHP
20 lines
430 B
PHP
|
<?php
|
||
|
declare (strict_types=1);
|
||
|
|
||
|
namespace app\middleware;
|
||
|
|
||
|
|
||
|
class CheckAdmin
|
||
|
{
|
||
|
public function handle($request, \Closure $next)
|
||
|
{
|
||
|
if (!request()->islogin) {
|
||
|
if ($request->isAjax() || !$request->isGet()) {
|
||
|
return json(['code'=>-1, 'msg'=>'未登录'])->code(401);
|
||
|
}
|
||
|
return redirect((string)url('/admin/login'));
|
||
|
}
|
||
|
return $next($request);
|
||
|
}
|
||
|
}
|