|
@@ -96,13 +96,24 @@ public class UtilServiceImpl implements UtilService {
|
|
|
t.setUserName(userName);
|
|
|
t.setUserPass(userPass);
|
|
|
Optional<SysUser> optional = userRepository.findOne(Example.of(t));
|
|
|
- if (!optional.isPresent()) {
|
|
|
+
|
|
|
+
|
|
|
+ // 手机号登录
|
|
|
+ SysUser t2 = new SysUser();
|
|
|
+ t2.setMobile(userName);
|
|
|
+ t2.setUserPass(userPass);
|
|
|
+ Optional<SysUser> optional2 = userRepository.findOne(Example.of(t2));
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if (!optional.isPresent() && !optional2.isPresent()) {
|
|
|
if (!loginFailed.containsKey(userName)) loginFailed.put(userName, 0);
|
|
|
loginFailed.put(userName, loginFailed.get(userName) + 1);
|
|
|
loginFailedTime.put(userName, System.currentTimeMillis() / 1000);
|
|
|
throw new ApiRuntimeException(501, "账号或密码错误!");
|
|
|
}
|
|
|
t = optional.get();
|
|
|
+ if(t == null && null != t2) t = t2;
|
|
|
if (null != t && !StringUtils.isEmpty(t.getId())) {
|
|
|
// 生成jwt token
|
|
|
Map<String, Object> map = new HashMap<>();
|