wip
This commit is contained in:
@@ -2,9 +2,12 @@
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\middleware;
|
||||
use app\common\Trait\ApiResponse;
|
||||
use think\facade\Session;
|
||||
class CheckLogin
|
||||
{
|
||||
use ApiResponse;
|
||||
|
||||
/**
|
||||
* 处理请求
|
||||
* @param \think\Request $request
|
||||
@@ -14,7 +17,7 @@ class CheckLogin
|
||||
public function handle($request, \Closure $next)
|
||||
{
|
||||
if (!Session::has('user_info')) {
|
||||
return json(['code' => 401, 'message' => '未登录']);
|
||||
return $this->error('未登录', [], 401);
|
||||
}
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user