| | |
| | | if(vo.orgTag == null || vo.orgTag.trim().length() == 0){ |
| | | return BaseResponseUtils.buildErrorMsg("未选择组织单位"); |
| | | } |
| | | if(vo.token == null || vo.token.trim().length() == 0){ |
| | | return BaseResponseUtils.buildErrorMsg("无token"); |
| | | } |
| | | if(vo.code == null || vo.code.trim().length() == 0){ |
| | | return BaseResponseUtils.buildErrorMsg("请输入验证码"); |
| | | } |
| | | //把组织单位标签作为数据源名称 |
| | | DataSourceContext.set(vo.orgTag); |
| | | |
| | | // 从数据库获取验证码 |
| | | Map map = sv.getCodeByToken(vo.token); |
| | | Long expiration = Long.parseLong(map.get("expiration").toString()); |
| | | Long currentTimestamp = System.currentTimeMillis(); |
| | | if(currentTimestamp > expiration) { |
| | | return BaseResponseUtils.buildErrorMsg("验证码已超时"); |
| | | } |
| | | String localCode = map.get("code").toString(); |
| | | if(!vo.code.equals(localCode)) { |
| | | return BaseResponseUtils.buildErrorMsg("验证码错误"); |
| | | if(vo.token != null || vo.token.trim().length() > 0) { |
| | | // 从session中获取验证码 |
| | | //HttpSession session = (HttpSession) request.getSession(); |
| | | //String localCode = session.getAttribute(token).toString(); |
| | | // 从数据库获取验证码 |
| | | Map map = sv.getCodeByToken(vo.token); |
| | | Long expiration = Long.parseLong(map.get("expiration").toString()); |
| | | Long currentTimestamp = System.currentTimeMillis(); |
| | | if(currentTimestamp > expiration) { |
| | | return BaseResponseUtils.buildErrorMsg("验证码已超时"); |
| | | } |
| | | String localCode = map.get("code").toString(); |
| | | if(!vo.code.equals(localCode)) { |
| | | return BaseResponseUtils.buildErrorMsg("验证码错误"); |
| | | } |
| | | } |
| | | |
| | | if(!sv.existPhone(vo.phone)){ |