Commit e9aa114f authored by Quxl's avatar Quxl

xx

parent 98d89338
...@@ -18,5 +18,5 @@ public interface TokenService { ...@@ -18,5 +18,5 @@ public interface TokenService {
boolean isLoginByToken(String token); boolean isLoginByToken(String token);
void log(HttpServletRequest request); void doLog(HttpServletRequest request);
} }
...@@ -34,7 +34,7 @@ public class AdminLoginController { ...@@ -34,7 +34,7 @@ public class AdminLoginController {
} else { } else {
LoginToken token = tokenService.doLogin(username, password); LoginToken token = tokenService.doLogin(username, password);
if(token != null) { if(token != null) {
tokenService.log(request); tokenService.doLog(request);
return Rjx.jsonOk().setData(token); return Rjx.jsonOk().setData(token);
} else { } else {
throw new XException("用户名或密码错误"); throw new XException("用户名或密码错误");
......
...@@ -101,7 +101,7 @@ public class AdminTokenServiceImpl implements AdminTokenService { ...@@ -101,7 +101,7 @@ public class AdminTokenServiceImpl implements AdminTokenService {
} }
@Override @Override
public void log(HttpServletRequest request) { public void doLog(HttpServletRequest request) {
LoginToken token = this.getToken(); LoginToken token = this.getToken();
String loginid = String.valueOf(token.getId()); String loginid = String.valueOf(token.getId());
Date now = new Date(); Date now = new Date();
......
...@@ -43,7 +43,7 @@ public class MemberLoginController { ...@@ -43,7 +43,7 @@ public class MemberLoginController {
} else { } else {
LoginToken token = tokenService.doLogin(username, password); LoginToken token = tokenService.doLogin(username, password);
if(token != null) { if(token != null) {
tokenService.log(request); tokenService.doLog(request);
return Rjx.jsonOk(); return Rjx.jsonOk();
} else { } else {
throw new XException(messages.get("err.user_or_pwd")); throw new XException(messages.get("err.user_or_pwd"));
......
...@@ -105,7 +105,7 @@ public class MemberTokenServiceImpl implements MemberTokenService { ...@@ -105,7 +105,7 @@ public class MemberTokenServiceImpl implements MemberTokenService {
} }
@Override @Override
public void log(HttpServletRequest request) { public void doLog(HttpServletRequest request) {
LoginToken token = this.getToken(); LoginToken token = this.getToken();
String loginid = String.valueOf(token.getId()); String loginid = String.valueOf(token.getId());
Date now = new Date(); Date now = new Date();
......
...@@ -96,7 +96,7 @@ public class UserTokenServiceImpl implements UserTokenService { ...@@ -96,7 +96,7 @@ public class UserTokenServiceImpl implements UserTokenService {
} }
@Override @Override
public void log(HttpServletRequest request) { public void doLog(HttpServletRequest request) {
LoginToken token = this.getToken(); LoginToken token = this.getToken();
String loginid = String.valueOf(token.getId()); String loginid = String.valueOf(token.getId());
Date now = new Date(); Date now = new Date();
......
...@@ -21,7 +21,7 @@ public class AdminLoginInterceptor extends HandlerInterceptorAdapter { ...@@ -21,7 +21,7 @@ public class AdminLoginInterceptor extends HandlerInterceptorAdapter {
@Override @Override
public boolean preHandle(HttpServletRequest req, HttpServletResponse resp, Object handler) throws Exception { public boolean preHandle(HttpServletRequest req, HttpServletResponse resp, Object handler) throws Exception {
if(tokenService.isLogin()) { if(tokenService.isLogin()) {
tokenService.log(req); tokenService.doLog(req);
return super.preHandle(req, resp, handler); return super.preHandle(req, resp, handler);
} else { } else {
String sessionid = null; String sessionid = null;
...@@ -32,7 +32,7 @@ public class AdminLoginInterceptor extends HandlerInterceptorAdapter { ...@@ -32,7 +32,7 @@ public class AdminLoginInterceptor extends HandlerInterceptorAdapter {
} }
} }
if(sessionid != null && tokenService.isLoginByToken(sessionid)) { if(sessionid != null && tokenService.isLoginByToken(sessionid)) {
tokenService.log(req); tokenService.doLog(req);
return super.preHandle(req, resp, handler); return super.preHandle(req, resp, handler);
} }
throw new XException("用户未登陆", 300); throw new XException("用户未登陆", 300);
......
...@@ -21,7 +21,7 @@ public class MemberLoginInterceptor extends HandlerInterceptorAdapter { ...@@ -21,7 +21,7 @@ public class MemberLoginInterceptor extends HandlerInterceptorAdapter {
@Override @Override
public boolean preHandle(HttpServletRequest req, HttpServletResponse resp, Object handler) throws Exception { public boolean preHandle(HttpServletRequest req, HttpServletResponse resp, Object handler) throws Exception {
if(tokenService.isLogin()) { if(tokenService.isLogin()) {
tokenService.log(req); tokenService.doLog(req);
return super.preHandle(req, resp, handler); return super.preHandle(req, resp, handler);
} else { } else {
String sessionid = null; String sessionid = null;
...@@ -32,7 +32,7 @@ public class MemberLoginInterceptor extends HandlerInterceptorAdapter { ...@@ -32,7 +32,7 @@ public class MemberLoginInterceptor extends HandlerInterceptorAdapter {
} }
} }
if(sessionid != null && tokenService.isLoginByToken(sessionid)) { if(sessionid != null && tokenService.isLoginByToken(sessionid)) {
tokenService.log(req); tokenService.doLog(req);
return super.preHandle(req, resp, handler); return super.preHandle(req, resp, handler);
} }
throw new XException("用户未登陆", 300); throw new XException("用户未登陆", 300);
......
...@@ -21,7 +21,7 @@ public class UserLoginInterceptor extends HandlerInterceptorAdapter { ...@@ -21,7 +21,7 @@ public class UserLoginInterceptor extends HandlerInterceptorAdapter {
@Override @Override
public boolean preHandle(HttpServletRequest req, HttpServletResponse resp, Object handler) throws Exception { public boolean preHandle(HttpServletRequest req, HttpServletResponse resp, Object handler) throws Exception {
if(tokenService.isLogin()) { if(tokenService.isLogin()) {
tokenService.log(req); tokenService.doLog(req);
return super.preHandle(req, resp, handler); return super.preHandle(req, resp, handler);
} else { } else {
String sessionid = null; String sessionid = null;
...@@ -32,7 +32,7 @@ public class UserLoginInterceptor extends HandlerInterceptorAdapter { ...@@ -32,7 +32,7 @@ public class UserLoginInterceptor extends HandlerInterceptorAdapter {
} }
} }
if(sessionid != null && tokenService.isLoginByToken(sessionid)) { if(sessionid != null && tokenService.isLoginByToken(sessionid)) {
tokenService.log(req); tokenService.doLog(req);
return super.preHandle(req, resp, handler); return super.preHandle(req, resp, handler);
} }
throw new XException("用户未登陆", 300); throw new XException("用户未登陆", 300);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment