| | |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取短信验证码 |
| | | * @param phone |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/queryCaptcha1") |
| | | @ApiOperation(value = "获取短信验证码", tags = {"用户端-分享"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "手机号码", name = "phone", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "场景类型(1=身份验证,2=登录确认,3=用户注册,4=修改密码)", name = "type", required = true, dataType = "String") |
| | | }) |
| | | public ResultUtil queryCaptcha1(String phone, Integer type){ |
| | | if(ToolUtil.isNotEmpty(phone)){ |
| | | try { |
| | | /* HttpSession session = request.getSession(); |
| | | String code = (String)session.getAttribute(Constants.KAPTCHA_SESSION_KEY);*/ |
| | | // String code = redisUtil.getValue(phone+"_Code"); |
| | | // System.out.println("缓存中验证码为:"+code); |
| | | // if (ToolUtil.isEmpty(kaptcha) || !kaptcha.equalsIgnoreCase(code)) { |
| | | // return ResultUtil.error("图形验证码错误"); |
| | | // } |
| | | return userInfoService.queryCaptcha(phone, type); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | }else{ |
| | | return ResultUtil.paranErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 手机验证码登录 |
| | | * @param phone |
| | |
| | | }) |
| | | public ResultUtil<LoginWarpper> captchaLogin_(String phone, String code, Integer uid, Integer type, Integer userType){ |
| | | try { |
| | | UserInfo userInfo = userInfoService.queryByPhone(phone); |
| | | if(null != userInfo){ |
| | | return ResultUtil.error("手机号已注册"); |
| | | } |
| | | return userInfoService.captchaLogin(phone, code, uid, type, userType); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |