Authored by zhaoyue

Mod get real ip

... ... @@ -49,7 +49,12 @@ public class CurrentAdminMethodArgumentResolver implements HandlerMethodArgument
//从数据库中查询并返回
XklAdminEntity admin = adminRepository.findByIdAndStatus(Long.parseLong(currentAdminId), Constants.STATUS_OK);
HttpServletRequest request = ((ServletWebRequest) webRequest).getRequest();
String ip = request.getRemoteAddr();
String ip = null;
if (request.getHeader("x-forwarded-for") == null) {
ip = request.getRemoteAddr();
} else {
ip = request.getHeader("x-forwarded-for");
}
admin.setIp(ip);
return admin;
}
... ...