Commit 08d2c004 authored by 技术部-任文超's avatar 技术部-任文超

添加极验开关

parent 3d92b780
...@@ -11,6 +11,7 @@ import cn.quantgroup.xyqb.util.IPUtil; ...@@ -11,6 +11,7 @@ import cn.quantgroup.xyqb.util.IPUtil;
import cn.quantgroup.xyqb.util.PasswordUtil; import cn.quantgroup.xyqb.util.PasswordUtil;
import cn.quantgroup.xyqb.util.ValidationUtil; import cn.quantgroup.xyqb.util.ValidationUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
...@@ -32,6 +33,8 @@ public class NewCaptchaController { ...@@ -32,6 +33,8 @@ public class NewCaptchaController {
private IGeetestCaptchaService geetestCaptchaService; private IGeetestCaptchaService geetestCaptchaService;
@Resource @Resource
private IQuantgroupCaptchaService quantgroupCaptchaService; private IQuantgroupCaptchaService quantgroupCaptchaService;
@Value("${geetest.close:false}")
private String geetestClose;
@LogHttpCaller @LogHttpCaller
@RequestMapping(value = "/captcha/new") @RequestMapping(value = "/captcha/new")
...@@ -43,9 +46,12 @@ public class NewCaptchaController { ...@@ -43,9 +46,12 @@ public class NewCaptchaController {
} }
// 数据容器 // 数据容器
Map<String, String> data = new HashMap<String, String>(); Map<String, String> data = new HashMap<String, String>();
Map<String, String> imgMap = null;
// 优先获取极验 // 优先获取极验
Map<String, String> imgMap = geetestCaptchaService.fetchGeetestCaptcha(PasswordUtil.MD5(phoneNo), remoteIp, ClientType.valueByName(clientType)); if(!Boolean.valueOf(geetestClose)){
imgMap = geetestCaptchaService.fetchGeetestCaptcha(PasswordUtil.MD5(phoneNo), remoteIp, ClientType.valueByName(clientType));
data.put(Constants.VERIFY_PARAM, Constants.VERIFY_TYPE_GT); data.put(Constants.VERIFY_PARAM, Constants.VERIFY_TYPE_GT);
}
// 备选方案:量化派图形验证码 // 备选方案:量化派图形验证码
if(Objects.isNull(imgMap) || imgMap.isEmpty()){ if(Objects.isNull(imgMap) || imgMap.isEmpty()){
imgMap = quantgroupCaptchaService.fetchQuantgroupCaptcha(request.getLocale()); imgMap = quantgroupCaptchaService.fetchQuantgroupCaptcha(request.getLocale());
......
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