加入会员合并同账号数据
This commit is contained in:
@@ -34,14 +34,14 @@ public class SaTokenConfigure implements WebMvcConfigurer {
|
||||
// adminConfig.setTimeout(1000);
|
||||
adminConfig.setTokenStyle("simple-uuid");
|
||||
adminConfig.setIsConcurrent(true);
|
||||
adminConfig.setIsShare(false);
|
||||
adminConfig.setIsShare(true);
|
||||
MyStpLogic.ADMIN_LOGIC.setConfig(adminConfig);
|
||||
|
||||
// 小程序配置
|
||||
SaTokenConfig userConfig = new SaTokenConfig();
|
||||
userConfig.setTokenName("token");
|
||||
userConfig.setIsConcurrent(true);
|
||||
userConfig.setIsShare(false);
|
||||
userConfig.setIsShare(true);
|
||||
// config2.setTimeout(2000);
|
||||
userConfig.setTokenStyle("simple-uuid");
|
||||
MyStpLogic.CLIENT_LOGIC.setConfig(userConfig);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.czg.sa;
|
||||
|
||||
import cn.dev33.satoken.SaManager;
|
||||
import cn.dev33.satoken.config.SaTokenConfig;
|
||||
import cn.dev33.satoken.context.SaHolder;
|
||||
import cn.dev33.satoken.context.model.SaRequest;
|
||||
@@ -69,6 +70,13 @@ public class MyStpLogic {
|
||||
}
|
||||
}
|
||||
|
||||
public void reLogin(long id) {
|
||||
StpLogic logic = getLogic();
|
||||
String token = logic.getTokenValue();
|
||||
// 重新绑定新的 userId 到这个 Token
|
||||
SaManager.getSaTokenDao().set(SaManager.getConfig().getTokenName() + ":" + token, String.valueOf(id), SaManager.getConfig().getTimeout());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前登录账号名称 管理端为用户账号 客户端为openId
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user