修正退出登录

This commit is contained in:
2023-03-17 09:00:51 +08:00
parent 21320b3ea4
commit f9e86d27b7
4 changed files with 92 additions and 11 deletions
+4 -1
View File
@@ -254,11 +254,14 @@ class UserService extends BaseService
}
$token = explode(' ', $bearer_token[0]);
if (!isset($token[1])){
return fail();
}
$redis = $this->container->get(Redis::class);
// 旧token加入黑名单 5天有效期,5天内,无法继续进行访问
$res = $redis->set('jwt_black_' . $token, time(), 60*60*24*5);
$res = $redis->set('jwt_black_' . $token[1], time(), 60*60*24*5);
if (!$res) {
return fail(HttpEnumCode::SERVER_ERROR);
}