|
@@ -105,33 +105,35 @@ public class LoginController extends BaseController {
|
|
|
*/
|
|
|
@PostMapping("/checkUser")
|
|
|
public Result checkUser(@RequestBody LoginParam param){
|
|
|
- if(StringUtils.isBlank(param.getAuthCode())){
|
|
|
- throw new BusinessException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
|
|
|
- }
|
|
|
-
|
|
|
- String id = request.getSession().getId();
|
|
|
- String redisKey = String.format(RedisKeyUtil.loginAuthCode,id);
|
|
|
- String redisCode = redisUtil.get(redisKey);
|
|
|
- if(!redisUtil.hasKey(redisKey)){
|
|
|
- throw new BusinessException(LoginConstant.FAILURE_CODE_3006, LoginConstant.FAILURE_MSG_3006);
|
|
|
- }
|
|
|
- redisUtil.del(redisKey);
|
|
|
- MathGenerator mathGenerator = new MathGenerator(2);
|
|
|
- boolean verify = mathGenerator.verify(redisCode,param.getAuthCode());
|
|
|
- if(!verify){
|
|
|
- throw new BusinessException(LoginConstant.FAILURE_CODE_3006, LoginConstant.FAILURE_MSG_3006);
|
|
|
- }
|
|
|
- Integer count = 0;
|
|
|
- if(redisUtil.hasKey(String.format(RedisKeyUtil.checkUserCount,id))){
|
|
|
- String countStr = redisUtil.get(String.format(RedisKeyUtil.checkUserCount, id));
|
|
|
- count = Integer.valueOf(countStr);
|
|
|
- if(count >=5){
|
|
|
- throw new BusinessException(LoginConstant.FAILURE_CODE_3038, LoginConstant.FAILURE_MSG_3038);
|
|
|
- }
|
|
|
- }
|
|
|
- count ++;
|
|
|
- redisUtil.set(String.format(RedisKeyUtil.checkUserCount,id),count+"",60);
|
|
|
- loginService.checkUser(param.getPhoneNum(),true);
|
|
|
+// if(StringUtils.isBlank(param.getAuthCode())){
|
|
|
+// throw new BusinessException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
|
|
|
+// }
|
|
|
+// String clientIP = ServletUtil.getClientIP(request);
|
|
|
+// Integer count = 0;
|
|
|
+// if(redisUtil.hasKey(String.format(RedisKeyUtil.checkUserCount,clientIP))){
|
|
|
+// String countStr = redisUtil.get(String.format(RedisKeyUtil.checkUserCount, clientIP));
|
|
|
+// count = Integer.valueOf(countStr);
|
|
|
+// if(count >=5){
|
|
|
+// throw new BusinessException(LoginConstant.FAILURE_CODE_3038, LoginConstant.FAILURE_MSG_3038);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// count ++;
|
|
|
+// redisUtil.set(String.format(RedisKeyUtil.checkUserCount,clientIP),count+"",60*5);
|
|
|
+//
|
|
|
+// String id = request.getSession().getId();
|
|
|
+// String redisKey = String.format(RedisKeyUtil.loginAuthCode,id);
|
|
|
+// String redisCode = redisUtil.get(redisKey);
|
|
|
+// if(!redisUtil.hasKey(redisKey)){
|
|
|
+// throw new BusinessException(LoginConstant.FAILURE_CODE_3006, LoginConstant.FAILURE_MSG_3006);
|
|
|
+// }
|
|
|
+// redisUtil.del(redisKey);
|
|
|
+// MathGenerator mathGenerator = new MathGenerator(2);
|
|
|
+// boolean verify = mathGenerator.verify(redisCode,param.getAuthCode());
|
|
|
+// if(!verify){
|
|
|
+// throw new BusinessException(LoginConstant.FAILURE_CODE_3006, LoginConstant.FAILURE_MSG_3006);
|
|
|
+// }
|
|
|
+//
|
|
|
+// loginService.checkUser(param.getPhoneNum(),true);
|
|
|
return Result.success();
|
|
|
}
|
|
|
/**
|