Commit f1ec877a authored by Quxl's avatar Quxl

x

parent d3899d0c
...@@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.ResponseBody; ...@@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
import com.egolm.common.bean.Rjx; import com.egolm.common.bean.Rjx;
import com.egolm.film.api.service.AdminTokenService; import com.egolm.film.api.service.AdminTokenService;
import com.egolm.film.config.XException; import com.egolm.film.config.XException;
import com.egolm.film.config.XRException;
import com.egolm.film.model.LoginToken; import com.egolm.film.model.LoginToken;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -30,7 +31,7 @@ public class AdminLoginController { ...@@ -30,7 +31,7 @@ public class AdminLoginController {
public Object login(String username, String password, HttpServletRequest request) { public Object login(String username, String password, HttpServletRequest request) {
XException.assertNotBlank("用户名或密码不能为空", username, password); XException.assertNotBlank("用户名或密码不能为空", username, password);
if(tokenService.isLogin()) { if(tokenService.isLogin()) {
throw new XException("用户已登录", 200); throw new XRException("用户已登录", 200);
} else { } else {
LoginToken token = tokenService.doLogin(username, password); LoginToken token = tokenService.doLogin(username, password);
if(token != null) { if(token != null) {
......
...@@ -12,6 +12,7 @@ import com.egolm.common.bean.Rjx; ...@@ -12,6 +12,7 @@ import com.egolm.common.bean.Rjx;
import com.egolm.film.api.service.MemberTokenService; import com.egolm.film.api.service.MemberTokenService;
import com.egolm.film.api.service.Messages; import com.egolm.film.api.service.Messages;
import com.egolm.film.config.XException; import com.egolm.film.config.XException;
import com.egolm.film.config.XRException;
import com.egolm.film.model.LoginToken; import com.egolm.film.model.LoginToken;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -39,7 +40,7 @@ public class MemberLoginController { ...@@ -39,7 +40,7 @@ public class MemberLoginController {
public Object login(String username, String password, HttpServletRequest request) { public Object login(String username, String password, HttpServletRequest request) {
XException.assertNotBlank(messages.get("err.user_pwd_null"), username, password); XException.assertNotBlank(messages.get("err.user_pwd_null"), username, password);
if(tokenService.isLogin()) { if(tokenService.isLogin()) {
throw new XException("", 200); throw new XRException("用户已登陆", 200);
} else { } else {
LoginToken token = tokenService.doLogin(username, password); LoginToken token = tokenService.doLogin(username, password);
if(token != null) { if(token != null) {
......
...@@ -10,6 +10,7 @@ import com.egolm.common.bean.Rjx; ...@@ -10,6 +10,7 @@ import com.egolm.common.bean.Rjx;
import com.egolm.film.api.service.Messages; import com.egolm.film.api.service.Messages;
import com.egolm.film.api.service.UserTokenService; import com.egolm.film.api.service.UserTokenService;
import com.egolm.film.config.XException; import com.egolm.film.config.XException;
import com.egolm.film.config.XRException;
import com.egolm.film.model.LoginToken; import com.egolm.film.model.LoginToken;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -32,7 +33,7 @@ public class UserLoginController { ...@@ -32,7 +33,7 @@ public class UserLoginController {
public Object login(String username, String password) { public Object login(String username, String password) {
XException.assertNotBlank(messages.get("err.user_pwd_null"), username, password); XException.assertNotBlank(messages.get("err.user_pwd_null"), username, password);
if(tokenService.isLogin()) { if(tokenService.isLogin()) {
throw new XException("", 200); throw new XRException("用户已登陆", 200);
} else { } else {
LoginToken token = tokenService.doLogin(username, password); LoginToken token = tokenService.doLogin(username, password);
if(token != null) { if(token != null) {
......
...@@ -25,7 +25,7 @@ public class ExceptionHandler implements HandlerExceptionResolver { ...@@ -25,7 +25,7 @@ public class ExceptionHandler implements HandlerExceptionResolver {
if (ex instanceof XException) { if (ex instanceof XException) {
Rjx rjx = ((XException) ex).getRjx(); Rjx rjx = ((XException) ex).getRjx();
mav.addAllObjects(rjx); mav.addAllObjects(rjx);
if(rjx.getCode() == 200 || rjx.getCode() == 300 || ex instanceof XRException) { if(ex instanceof XRException) {
displayInLog = false; displayInLog = false;
logger.debug(ex.getMessage()); logger.debug(ex.getMessage());
} }
......
...@@ -9,7 +9,7 @@ import org.springframework.stereotype.Component; ...@@ -9,7 +9,7 @@ import org.springframework.stereotype.Component;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import com.egolm.film.api.service.AdminTokenService; import com.egolm.film.api.service.AdminTokenService;
import com.egolm.film.config.XException; import com.egolm.film.config.XRException;
@Component @Component
public class AdminLoginInterceptor extends HandlerInterceptorAdapter { public class AdminLoginInterceptor extends HandlerInterceptorAdapter {
...@@ -36,7 +36,7 @@ public class AdminLoginInterceptor extends HandlerInterceptorAdapter { ...@@ -36,7 +36,7 @@ public class AdminLoginInterceptor extends HandlerInterceptorAdapter {
tokenService.doLog(req); tokenService.doLog(req);
return super.preHandle(req, resp, handler); return super.preHandle(req, resp, handler);
} }
throw new XException("用户未登陆", 300); throw new XRException("用户未登陆", 300);
} }
} }
......
...@@ -9,7 +9,7 @@ import org.springframework.stereotype.Component; ...@@ -9,7 +9,7 @@ import org.springframework.stereotype.Component;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import com.egolm.film.api.service.MemberTokenService; import com.egolm.film.api.service.MemberTokenService;
import com.egolm.film.config.XException; import com.egolm.film.config.XRException;
@Component @Component
public class MemberLoginInterceptor extends HandlerInterceptorAdapter { public class MemberLoginInterceptor extends HandlerInterceptorAdapter {
...@@ -36,7 +36,7 @@ public class MemberLoginInterceptor extends HandlerInterceptorAdapter { ...@@ -36,7 +36,7 @@ public class MemberLoginInterceptor extends HandlerInterceptorAdapter {
tokenService.doLog(req); tokenService.doLog(req);
return super.preHandle(req, resp, handler); return super.preHandle(req, resp, handler);
} }
throw new XException("用户未登陆", 300); throw new XRException("用户未登陆", 300);
} }
} }
......
...@@ -9,7 +9,7 @@ import org.springframework.stereotype.Component; ...@@ -9,7 +9,7 @@ import org.springframework.stereotype.Component;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import com.egolm.film.api.service.UserTokenService; import com.egolm.film.api.service.UserTokenService;
import com.egolm.film.config.XException; import com.egolm.film.config.XRException;
@Component @Component
public class UserLoginInterceptor extends HandlerInterceptorAdapter { public class UserLoginInterceptor extends HandlerInterceptorAdapter {
...@@ -34,7 +34,7 @@ public class UserLoginInterceptor extends HandlerInterceptorAdapter { ...@@ -34,7 +34,7 @@ public class UserLoginInterceptor extends HandlerInterceptorAdapter {
tokenService.doLog(req); tokenService.doLog(req);
return super.preHandle(req, resp, handler); return super.preHandle(req, resp, handler);
} }
throw new XException("用户未登陆", 300); throw new XRException("用户未登陆", 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