update 数据库更改 对接多用户体系

This commit is contained in:
疯狂的狮子li
2022-01-17 17:09:27 +08:00
parent 3600875707
commit 911867d5a5
11 changed files with 93 additions and 47 deletions

View File

@ -19,7 +19,9 @@ import lombok.NoArgsConstructor;
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class LoginHelper {
private static final String LOGIN_USER_KEY = "loginUser";
public static final String JOIN_CODE = ":";
public static final String LOGIN_USER_KEY = "loginUser";
private static final ThreadLocal<LoginUser> LOGIN_CACHE = new ThreadLocal<>();
/**
@ -80,7 +82,9 @@ public class LoginHelper {
String userId = null;
for (UserType value : UserType.values()) {
if (StringUtils.contains(loginId, value.getUserType())) {
userId = StringUtils.replace(loginId, value.getUserType(), StringUtils.EMPTY);
String[] strs = StringUtils.split(loginId, JOIN_CODE);
// 用户id在总是在最后
userId = strs[strs.length - 1];
}
}
if (StringUtils.isBlank(userId)) {