删除AI的小巧思2
This commit is contained in:
@@ -7,7 +7,6 @@ package com.bao.dating.context;
|
||||
public class UserContext {
|
||||
|
||||
private static final ThreadLocal<Long> USER_HOLDER = new ThreadLocal<>();
|
||||
private static final ThreadLocal<String> TOKEN_HOLDER = new ThreadLocal<>();
|
||||
|
||||
/**
|
||||
* 设置当前线程的用户ID
|
||||
@@ -25,27 +24,4 @@ public class UserContext {
|
||||
return USER_HOLDER.get();
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置当前线程的token
|
||||
* @param token 用户token
|
||||
*/
|
||||
public static void setToken(String token) {
|
||||
TOKEN_HOLDER.set(token);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前线程的token
|
||||
* @return 当前token,如果未设置则返回null
|
||||
*/
|
||||
public static String getToken() {
|
||||
return TOKEN_HOLDER.get();
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除当前线程的用户ID和token
|
||||
*/
|
||||
public static void clear() {
|
||||
USER_HOLDER.remove();
|
||||
TOKEN_HOLDER.remove();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user