mirror of https://github.com/elunez/eladmin
代码优化
parent
da006624a4
commit
bc5187a7ad
|
@ -4,6 +4,7 @@ import io.swagger.annotations.Api;
|
|||
import io.swagger.annotations.ApiOperation;
|
||||
import me.zhengjie.aop.log.Log;
|
||||
import me.zhengjie.modules.security.service.OnlineUserService;
|
||||
import me.zhengjie.utils.EncryptUtils;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
|
@ -48,6 +49,8 @@ public class OnlineController {
|
|||
@PreAuthorize("@el.check()")
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<String> keys) throws Exception {
|
||||
for (String key : keys) {
|
||||
// 解密Key
|
||||
key = EncryptUtils.desDecrypt(key);
|
||||
onlineUserService.kickOut(key);
|
||||
}
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
|
|
|
@ -90,8 +90,8 @@ public class OnlineUserService {
|
|||
* @param key /
|
||||
* @throws Exception /
|
||||
*/
|
||||
public void kickOut(String key) throws Exception {
|
||||
key = properties.getOnlineKey() + EncryptUtils.desDecrypt(key);
|
||||
public void kickOut(String key){
|
||||
key = properties.getOnlineKey() + key;
|
||||
redisUtils.del(key);
|
||||
}
|
||||
|
||||
|
@ -148,9 +148,9 @@ public class OnlineUserService {
|
|||
try {
|
||||
String token =EncryptUtils.desDecrypt(onlineUser.getKey());
|
||||
if(StringUtils.isNotBlank(igoreToken)&&!igoreToken.equals(token)){
|
||||
this.kickOut(onlineUser.getKey());
|
||||
this.kickOut(token);
|
||||
}else if(StringUtils.isBlank(igoreToken)){
|
||||
this.kickOut(onlineUser.getKey());
|
||||
this.kickOut(token);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("checkUser is error",e);
|
||||
|
|
Loading…
Reference in New Issue