2
0

fix: 退出登录区分客户和用户

This commit is contained in:
caiyuchao
2025-01-22 17:26:40 +08:00
parent abd6af31ed
commit 043165fe70
2 changed files with 13 additions and 5 deletions

View File

@@ -77,10 +77,15 @@ public class TokenController {
String token = SecurityUtils.getToken(request);
if (StringUtils.isNotEmpty(token)) {
String username = JwtUtils.getUserName(token);
String userPlatform = JwtUtils.getUserPlatform(token);
// 删除用户缓存记录
AuthUtil.logoutByToken(token);
// 记录用户退出日志
sysLoginService.logout(username);
if ("user".equals(userPlatform)) {
uLoginService.logout(username);
} else {
sysLoginService.logout(username);
}
}
return R.ok();
}
@@ -115,13 +120,14 @@ public class TokenController {
uLoginService.checkRepeat(form);
return R.ok();
}
if ("sys".equals(form.getAuthType())) {}
if ("sys".equals(form.getAuthType())) {
}
return R.fail("auth.authentication.type.not.supported");
}
@GetMapping("health")
public R<?> health(HttpServletRequest request) {
// check health
return R.ok(null,"auth.is.healthy");
return R.ok(null, "auth.is.healthy");
}
}

View File

@@ -48,7 +48,9 @@ public class UClientServiceImpl extends ServiceImpl<UClientMapper, UClient> impl
}
boolean flag = this.saveOrUpdate(uClient);
// 登录时如果当前用户有可用套餐和余额授权当前设备访问wifi且根据套餐限制带宽
accountService.authClientAndRateLimit(uClientBo);
if (StrUtil.isNotBlank(uClientBo.getClientName()) && StrUtil.isNotBlank(uClientBo.getSiteId())) {
accountService.authClientAndRateLimit(uClientBo);
}
return flag;
}