user_id 传值为姓名的问题
This commit is contained in:
parent
1c302187cf
commit
e27f26b9d8
|
|
@ -100,7 +100,7 @@ public class SysLoginService
|
||||||
public void recordLogininfor(String username, String status, String message)
|
public void recordLogininfor(String username, String status, String message)
|
||||||
{
|
{
|
||||||
SysLogininfor logininfor = new SysLogininfor();
|
SysLogininfor logininfor = new SysLogininfor();
|
||||||
logininfor.setUserName(username);
|
logininfor.setUserName(isStrictPositiveInteger(username) ? username : "0");
|
||||||
logininfor.setIpaddr(IpUtils.getIpAddr(ServletUtils.getRequest()));
|
logininfor.setIpaddr(IpUtils.getIpAddr(ServletUtils.getRequest()));
|
||||||
logininfor.setMsg(message);
|
logininfor.setMsg(message);
|
||||||
// 日志状态
|
// 日志状态
|
||||||
|
|
@ -119,4 +119,13 @@ public class SysLoginService
|
||||||
recordLogininfor(userId, Constants.LOGOUT, "退出成功");
|
recordLogininfor(userId, Constants.LOGOUT, "退出成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 严格模式(不允许前导零)
|
||||||
|
private static final String STRICT_POSITIVE_REGEX = "^[1-9][0-9]*$";
|
||||||
|
public static boolean isStrictPositiveInteger(String str) {
|
||||||
|
if (str == null || str.isEmpty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return str.trim().matches(STRICT_POSITIVE_REGEX);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue