|
|
@ -193,30 +193,30 @@ public class UserInfoService {
|
|
|
|
return userInfoDao.countByNickName(nickName);
|
|
|
|
return userInfoDao.countByNickName(nickName);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public String loginOrRegister(UserInfo userInfo) {
|
|
|
|
public String loginOrRegister(UserInfo loginUserInfo) {
|
|
|
|
UserInfo user = userInfoDao.findByMobile(userInfo.getMobile());
|
|
|
|
UserInfo userInfo = userInfoDao.findByMobile(loginUserInfo.getMobile());
|
|
|
|
if (null == user) {
|
|
|
|
if (null == userInfo) {
|
|
|
|
user = userInfo;
|
|
|
|
userInfo = loginUserInfo;
|
|
|
|
user.setId(String.valueOf(idWorker.nextId()));
|
|
|
|
userInfo.setId(String.valueOf(idWorker.nextId()));
|
|
|
|
user.setNickName("雀乐-" + NickNameUtil.getRandomNickName());
|
|
|
|
userInfo.setNickName("雀乐-" + NickNameUtil.getRandomNickName());
|
|
|
|
Date curDate = new Date();
|
|
|
|
Date curDate = new Date();
|
|
|
|
user.setJoinTime(curDate);
|
|
|
|
userInfo.setJoinTime(curDate);
|
|
|
|
user.setLastLoginTime(curDate);
|
|
|
|
userInfo.setLastLoginTime(curDate);
|
|
|
|
user.setStatus(UserStatusEnum.ENABLE.getStatus());
|
|
|
|
userInfo.setStatus(UserStatusEnum.ENABLE.getStatus());
|
|
|
|
user.setAvatar(Constants.DEFAULT_USER_AVATAR);
|
|
|
|
userInfo.setAvatar(Constants.DEFAULT_USER_AVATAR);
|
|
|
|
user.setSignature(Constants.DEFAULT_USER_SIGNATURE);
|
|
|
|
userInfo.setSignature(Constants.DEFAULT_USER_SIGNATURE);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
user.setLastUseDeviceId(userInfo.getLastUseDeviceId());
|
|
|
|
userInfo.setLastUseDeviceId(loginUserInfo.getLastUseDeviceId());
|
|
|
|
user.setLastUseDeviceBrand(userInfo.getLastUseDeviceBrand());
|
|
|
|
userInfo.setLastUseDeviceBrand(loginUserInfo.getLastUseDeviceBrand());
|
|
|
|
user.setLastLoginIp(userInfo.getLastLoginIp());
|
|
|
|
userInfo.setLastLoginIp(loginUserInfo.getLastLoginIp());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!UserStatusEnum.ENABLE.getStatus().equals(user.getStatus())) {
|
|
|
|
if (!UserStatusEnum.ENABLE.getStatus().equals(userInfo.getStatus())) {
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
user.setLastLoginTime(new Date());
|
|
|
|
userInfo.setLastLoginTime(new Date());
|
|
|
|
userInfoDao.save(user);
|
|
|
|
userInfoDao.save(userInfo);
|
|
|
|
return Constants.TOKEN_PREFIX
|
|
|
|
return Constants.TOKEN_PREFIX
|
|
|
|
+ jwtUtil.createJWT(user.getId(), user.getNickName(), Constants.TOKEN_ROLE_APP_USER, user.getAvatar());
|
|
|
|
+ jwtUtil.createJWT(userInfo.getId(), userInfo.getNickName(), Constants.TOKEN_ROLE_APP_USER, userInfo.getAvatar());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public List<UserInfo> orderByField(List<String> idList) {
|
|
|
|
public List<UserInfo> orderByField(List<String> idList) {
|
|
|
|