Commit b38948a2 authored by 唐峰's avatar 唐峰

登录获取极验异常时的NPE处理

parent b5711d5c
...@@ -14,6 +14,7 @@ import cn.quantgroup.xyqb.service.captcha.IGeetestCaptchaService; ...@@ -14,6 +14,7 @@ import cn.quantgroup.xyqb.service.captcha.IGeetestCaptchaService;
import cn.quantgroup.xyqb.service.captcha.IGeetestLogService; import cn.quantgroup.xyqb.service.captcha.IGeetestLogService;
import cn.quantgroup.xyqb.service.captcha.IQuantgroupCaptchaService; import cn.quantgroup.xyqb.service.captcha.IQuantgroupCaptchaService;
import cn.quantgroup.xyqb.util.PasswordUtil; import cn.quantgroup.xyqb.util.PasswordUtil;
import com.google.common.collect.Maps;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -63,7 +64,6 @@ public class GeetestBehaviorStrategy implements BehaviorStrategy { ...@@ -63,7 +64,6 @@ public class GeetestBehaviorStrategy implements BehaviorStrategy {
return (boolean) result.get("valid"); return (boolean) result.get("valid");
} }
@Override @Override
public BehaviorCodeBean generate(BehaviorReq behaviorReq) { public BehaviorCodeBean generate(BehaviorReq behaviorReq) {
BehaviorCodeBean behaviorCodeBean = new BehaviorCodeBean(); BehaviorCodeBean behaviorCodeBean = new BehaviorCodeBean();
...@@ -83,6 +83,8 @@ public class GeetestBehaviorStrategy implements BehaviorStrategy { ...@@ -83,6 +83,8 @@ public class GeetestBehaviorStrategy implements BehaviorStrategy {
imgMap = geetestCaptchaService.fetchGeetestCaptcha(PasswordUtil.MD5(key), behaviorReq.getIp(), ClientType.valueByCode(behaviorReq.getClientType())); imgMap = geetestCaptchaService.fetchGeetestCaptcha(PasswordUtil.MD5(key), behaviorReq.getIp(), ClientType.valueByCode(behaviorReq.getClientType()));
} }
imgMap = imgMap == null ? Maps.newHashMap() : imgMap;
if (imgMap.containsKey("success") && "1".equals(imgMap.get("success"))) { if (imgMap.containsKey("success") && "1".equals(imgMap.get("success"))) {
behaviorCodeBean.setType(1); behaviorCodeBean.setType(1);
behaviorCodeBean.setGeetestCode(BehaviorCodeBean.GeetestCode.builder().gt(imgMap.get("gt")) behaviorCodeBean.setGeetestCode(BehaviorCodeBean.GeetestCode.builder().gt(imgMap.get("gt"))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment