瀏覽代碼

登录用户去掉时间戳

小么熊🐻 2 年之前
父節點
當前提交
ce14fdd177

+ 3 - 3
nbjk-common/src/main/java/com/miaxis/common/core/domain/model/LoginUser.java

@@ -96,12 +96,12 @@ public class LoginUser implements UserDetails
 
     public LoginUser(UserInfo student,String loginType) {
         this.student = student;
-        this.id= "student:"+student.getId()+"_"+loginType+"_"+System.currentTimeMillis();
+        this.id= "student:"+student.getId()+"_"+loginType;
     }
 
     public LoginUser(UserInfo student) {
         this.student = student;
-        this.id= "student:"+student.getId()+"_"+System.currentTimeMillis();
+        this.id= "student:"+student.getId();
     }
 
 
@@ -129,7 +129,7 @@ public class LoginUser implements UserDetails
     {
         this.user = user;
         this.permissions = permissions;
-        this.id = "sysUser:"+user.getUserId()+"_"+System.currentTimeMillis();
+        this.id = "sysUser:"+user.getUserId();
     }
 
     @JsonIgnore

+ 6 - 14
nbjk-framework/src/main/java/com/miaxis/framework/web/service/TokenService.java

@@ -152,12 +152,12 @@ public class TokenService
         // 根据uuid将loginUser缓存
         String userKey = getTokenKey(loginUser.getToken());
         //如果不是系统用户
-        //if (loginUser.getUser()== null){
-            //确保唯一登录
-            //uniqueLogin(loginUser.getId(),userKey,expireTime);
-
-        //}
-
+       // if (loginUser.getUser()== null){
+       //     String key = redisCache.getCacheObject(loginUser.getId());
+       //     if (key != null){
+       //         redisCache.deleteObject(key);
+       //     }
+       // }
         //保存用户key(方便以后查找用户信息)
         redisCache.setCacheObject(loginUser.getId(),userKey, expireTime,TimeUnit.MINUTES);
         //保存JWT用户信息
@@ -165,14 +165,6 @@ public class TokenService
 
     }
 
-    private void uniqueLogin(String id, String userKey,int timeout) {
-        String key = redisCache.getCacheObject(id);
-        if (key != null){
-            redisCache.deleteObject(key);
-        }
-        redisCache.setCacheObject(id,userKey,timeout,TimeUnit.MINUTES);
-
-    }
 
     /**
      * 设置用户代理信息