perf:空指针调整
This commit is contained in:
@@ -20,8 +20,7 @@ public class DoLoginInfo {
|
|||||||
this.info = info;
|
this.info = info;
|
||||||
|
|
||||||
// 设置IP
|
// 设置IP
|
||||||
HttpServletRequest request = ServletKit.getRequest();
|
this.loginIp = ServletKit.getClientIP();
|
||||||
this.loginIp = ServletKit.getClientIP(request);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@@ -23,6 +23,21 @@ public class ServletKit extends ServletUtil {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取请求头
|
||||||
|
*
|
||||||
|
* @param name 请求头
|
||||||
|
* @return 请求头
|
||||||
|
*/
|
||||||
|
public static String getHeader(String name) {
|
||||||
|
HttpServletRequest request = getRequest();
|
||||||
|
if (request == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return getHeader(request, name, "utf-8");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取客户端IP
|
* 获取客户端IP
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ public class TsCacheService {
|
|||||||
* 验证 图片验证码
|
* 验证 图片验证码
|
||||||
*/
|
*/
|
||||||
public void verifyCaptcha(String value) {
|
public void verifyCaptcha(String value) {
|
||||||
String captchaKey = ServletUtil.getHeader(ServletKit.getRequest(), "captcha", "utf-8");
|
String captchaKey = ServletKit.getHeader("captcha");
|
||||||
String cache = get(captchaKey);
|
String cache = get(captchaKey);
|
||||||
if (StrUtil.isEmpty(cache) || !StrUtil.equals(cache, value)) {
|
if (StrUtil.isEmpty(cache) || !StrUtil.equals(cache, value)) {
|
||||||
throw new ApiException("验证码不正确");
|
throw new ApiException("验证码不正确");
|
||||||
|
|||||||
@@ -56,8 +56,12 @@ public class OperationAspect {
|
|||||||
@Around("methodArgs()")
|
@Around("methodArgs()")
|
||||||
public Object around(ProceedingJoinPoint joinPoint) throws Throwable {
|
public Object around(ProceedingJoinPoint joinPoint) throws Throwable {
|
||||||
|
|
||||||
// GET请求不处理
|
|
||||||
HttpServletRequest request = ServletKit.getRequest();
|
HttpServletRequest request = ServletKit.getRequest();
|
||||||
|
if (request == null) {
|
||||||
|
return joinPoint.proceed();
|
||||||
|
}
|
||||||
|
|
||||||
|
// GET请求不处理
|
||||||
if (StrUtil.equalsIgnoreCase(request.getMethod(), "GET")) {
|
if (StrUtil.equalsIgnoreCase(request.getMethod(), "GET")) {
|
||||||
return joinPoint.proceed(joinPoint.getArgs());
|
return joinPoint.proceed(joinPoint.getArgs());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user