优化代码

This commit is contained in:
none 2023-03-21 14:59:10 +08:00
parent ad02bcad59
commit 57535a2ce7
3 changed files with 2 additions and 11 deletions

View File

@ -14,7 +14,6 @@ public class PlayEduFCtx {
private static final String KEY_USER_ID = "user_id"; private static final String KEY_USER_ID = "user_id";
private static final String KEY_USER = "user"; private static final String KEY_USER = "user";
private static final String KEY_JWT_JTI = "jwt_jti"; private static final String KEY_JWT_JTI = "jwt_jti";
private static final String KEY_TOKEN = "token";
public PlayEduFCtx() { public PlayEduFCtx() {
} }
@ -59,12 +58,4 @@ public class PlayEduFCtx {
public static String getJwtJti() { public static String getJwtJti() {
return (String) get(KEY_JWT_JTI); return (String) get(KEY_JWT_JTI);
} }
public static void setToken(String token) {
put(KEY_TOKEN, token);
}
public static String getToken() {
return (String) get(KEY_TOKEN);
}
} }

View File

@ -68,7 +68,7 @@ public class LoginController {
@PostMapping("/logout") @PostMapping("/logout")
public JsonResponse logout() throws JwtLogoutException { public JsonResponse logout() throws JwtLogoutException {
jwtService.logout(RequestUtil.token(), SystemConstant.JWT_PRV_ADMIN_USER); jwtService.adminUserLogout(RequestUtil.token());
return JsonResponse.success("success"); return JsonResponse.success("success");
} }

View File

@ -70,7 +70,7 @@ public class LoginController {
@PostMapping("/logout") @PostMapping("/logout")
public JsonResponse logout() throws JwtLogoutException { public JsonResponse logout() throws JwtLogoutException {
jwtService.userLogout(PlayEduFCtx.getToken()); jwtService.userLogout(RequestUtil.token());
ctx.publishEvent(new UserLogoutEvent(this, PlayEduFCtx.getUserId(), PlayEduFCtx.getJwtJti())); ctx.publishEvent(new UserLogoutEvent(this, PlayEduFCtx.getUserId(), PlayEduFCtx.getJwtJti()));
return JsonResponse.success(); return JsonResponse.success();
} }