|
|
@@ -152,13 +152,17 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
|
|
|
* @return
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public String login(LoginDto dto) {
|
|
|
- AppCurrentLoginUser userDetails = (AppCurrentLoginUser) loadUserByUsername(dto.getLoginName());
|
|
|
- if (ObjectUtils.isNull(userDetails.getOrderEndTime())){
|
|
|
- throw new BadCredentialsException("请充值后在进行登录");
|
|
|
+ public ResultResponse login(LoginDto dto) {
|
|
|
+ String encrypt = Sm4Util.encrypt(dto.getLoginName());
|
|
|
+ AppUser appUser = selectByMobile(encrypt, "0");
|
|
|
+ if (appUser == null) {
|
|
|
+ throw new BadCredentialsException("用户不存在");
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isNull(appUser.getOrderEndTime())){
|
|
|
+ return ResultResponse.success(false);
|
|
|
}
|
|
|
- if (LocalDate.parse(userDetails.getOrderEndTime()).isBefore(LocalDate.now())){
|
|
|
- throw new BadCredentialsException("你的套餐已到期,请充值后登录!");
|
|
|
+ if (LocalDate.parse(appUser.getOrderEndTime()).isBefore(LocalDate.now())){
|
|
|
+ return ResultResponse.success(false);
|
|
|
}
|
|
|
|
|
|
String errorNumKey = "app:error:num:"+dto.getLoginName();
|
|
|
@@ -169,7 +173,7 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
|
|
|
}
|
|
|
}
|
|
|
dto.setPassWord(CryptoUtil.decrypt(dto.getPassWord()));
|
|
|
- if (!bCryptPasswordEncoder.matches(dto.getPassWord(), userDetails.getPassword())) {
|
|
|
+ if (!bCryptPasswordEncoder.matches(dto.getPassWord(), appUser.getPwd())) {
|
|
|
Integer errorNum = 0;
|
|
|
if (ObjectUtils.isNotNull(errorNumRedis)){
|
|
|
errorNum = Integer.parseInt(errorNumRedis);
|
|
|
@@ -178,6 +182,7 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
|
|
|
redisClient.set(errorNumKey,String.valueOf(errorNum),600);
|
|
|
throw new BadCredentialsException("密码不正确");
|
|
|
}
|
|
|
+ AppCurrentLoginUser userDetails = (AppCurrentLoginUser) createAppLoginUser(appUser);
|
|
|
String token = tokenUtil.generateToken(userDetails, dto.getRememberMe(),"app");
|
|
|
String tokenRedis = redisClient.get(String.format("%s%s", "token:app:", dto.getLoginName()),"");
|
|
|
if (StringUtils.isNotBlank(tokenRedis)){
|
|
|
@@ -194,7 +199,7 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
|
|
|
loginRecord.setOrgCode(userDetails.getOrgCode());
|
|
|
loginRecord.setOrgName(userDetails.getOrgName());
|
|
|
loginRecordMapper.insert(loginRecord);
|
|
|
- return token;
|
|
|
+ return ResultResponse.success(token);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -418,6 +423,9 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
|
|
|
return ResultResponse.fail("手机号已经存在");
|
|
|
}
|
|
|
|
|
|
+ String pwd = "Wllt"+ "+" + appUser.getIdCard().substring(14, 18);
|
|
|
+ appUser.setPwd(bCryptPasswordEncoder.encode(pwd));
|
|
|
+
|
|
|
appUserMapper.insert(appUser);
|
|
|
//首次登陆欢迎语
|
|
|
log.info("<<<<<<<<<<<<发送首次登陆欢迎语IM>>用户信息:{}>>>>>>>>>>",JSON.toJSONString(appUser));
|
|
|
@@ -540,7 +548,9 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
|
|
|
gameDto.setPlayClass("C");
|
|
|
gameDto.setGameLevel(gameUser.getCurrentLevel());
|
|
|
gameDto.setGameId(gameUser.getId());
|
|
|
- gameDtos.add(gameDto);
|
|
|
+ if ("0".equals(gameUser.getIsShow())){
|
|
|
+ gameDtos.add(gameDto);
|
|
|
+ }
|
|
|
}
|
|
|
return gameDtos;
|
|
|
}else if("A".equals(playClass)){
|
|
|
@@ -746,8 +756,10 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
|
|
|
}
|
|
|
Random rand = new Random();
|
|
|
int randomNumber = rand.nextInt(1000000);
|
|
|
- String random = String.format("%06d", randomNumber);
|
|
|
- Boolean isSuccess = SmgUtil.sendCheckCode(mobile, MsgTemplateEnums.GET_CHECK_CODE.getTempalteCode(), random);
|
|
|
+// String random = String.format("%06d", randomNumber);
|
|
|
+// Boolean isSuccess = SmgUtil.sendCheckCode(mobile, MsgTemplateEnums.CHANGE_PASSWORD_CODE.getTempalteCode(), random);
|
|
|
+ String random = "123456";
|
|
|
+ Boolean isSuccess = true;
|
|
|
if (isSuccess) {
|
|
|
// 防机器
|
|
|
redisClient.set("hcp:sms:changePass:mobile:"+mobile,random,120);
|
|
|
@@ -1022,6 +1034,9 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
|
|
|
appUser.setTestFlag("1");
|
|
|
appUser.setCreateTime(new Date());
|
|
|
appUser.setUpdateTime(new Date());
|
|
|
+
|
|
|
+ String pwd = "Wllt"+ "+" + appUser.getIdCard().substring(14, 18);
|
|
|
+ appUser.setPwd(bCryptPasswordEncoder.encode(pwd));
|
|
|
//新增用户脑力值是0分
|
|
|
appUser.setMentalEnergy(0);
|
|
|
appUser.setCreateBy("微信公众号");
|