modified 完善登出中间件

This commit is contained in:
zhaoxiang 2020-10-12 15:21:04 +08:00
parent 7ecc2c4b06
commit 8677d13bb5

View File

@ -20,7 +20,9 @@ class AdminAuth {
$ApiAuth = $request->header('Api-Auth', ''); $ApiAuth = $request->header('Api-Auth', '');
if ($ApiAuth) { if ($ApiAuth) {
$userInfo = cache('Login:' . $ApiAuth); $userInfo = cache('Login:' . $ApiAuth);
$userInfo = json_decode($userInfo, true); if ($userInfo) {
$userInfo = json_decode($userInfo, true);
}
if (!$userInfo || !isset($userInfo['id'])) { if (!$userInfo || !isset($userInfo['id'])) {
return json([ return json([
'code' => ReturnCode::AUTH_ERROR, 'code' => ReturnCode::AUTH_ERROR,