diff --git a/sa-token-doc/plugin/thymeleaf-extend.md b/sa-token-doc/plugin/thymeleaf-extend.md index 93a75bc2..e3f8b557 100644 --- a/sa-token-doc/plugin/thymeleaf-extend.md +++ b/sa-token-doc/plugin/thymeleaf-extend.md @@ -24,7 +24,6 @@ implementation 'cn.dev33:sa-token-thymeleaf:${sa.top.version}' ``` -123 ### 2、注册标签方言对象 在 SaTokenConfigure 配置类中注册 Bean diff --git a/sa-token-doc/up/many-account.md b/sa-token-doc/up/many-account.md index 800d50a5..a4a504af 100644 --- a/sa-token-doc/up/many-account.md +++ b/sa-token-doc/up/many-account.md @@ -288,6 +288,32 @@ public void addInterceptors(InterceptorRegistry registry) { ``` +### 11、在一个接口里获取是哪个体系的账号正在登录 + +可以分别用两个体系的 isLogin() 方法去判断,哪个返回 true 就代表正在登录哪个体系 + +``` java +@RequestMapping("test") +public SaResult test2() { + + String loginType = ""; + + if(StpUtil.isLogin()) { + loginType = StpUtil.getLoginType(); + } + if(StpUserUtil.isLogin()) { + loginType = StpUserUtil.getLoginType(); + } + + System.out.println("当前登录的 loginType:" + loginType); + + return SaResult.ok(); +} +``` + +请注意此处可能出现的两种边际情况: +- 两个 if 均返回 false:代表客户端在两个账号体系都没有登录。 +- 两个 if 均返回 true:代表客户端在两个账号体系都登录了。