提交 28b7ef02 authored 作者: renjiancai's avatar renjiancai

--no commit message

上级 2f00c3d7
package com.zrqx.member.fg.captcha.controller;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -11,6 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
import com.zrqx.core.components.captcha.form.CaptchaForm;
import com.zrqx.core.components.captcha.service.BlockPuzzleCaptchaValidateServiceImpl;
import com.zrqx.core.constant.member.MemberRequestPath;
import com.zrqx.core.enums.captcha.CaptchaBusinessTypeEnum;
import com.zrqx.core.enums.captcha.CaptchaTypeEnum;
import com.zrqx.core.exception.ValidateException;
import com.zrqx.core.util.datatype.StringUtils;
......@@ -33,11 +36,21 @@ public class CaptchaController {
private static final Logger log = LoggerFactory.getLogger(CaptchaController.class);
@Autowired
private SpringContextUtils springContextUtils;
@Autowired
@Qualifier("blockPuzzleCaptchaServiceImpl")
private CaptchaService blockPuzzleCaptchaService;
private CaptchaService getService(CaptchaForm form) {
if (StringUtils.isEmpty(form.getType())) {
throw new ValidateException("type不能为空");
}
CaptchaService service = springContextUtils.getEnumsBindBean(CaptchaTypeEnum.class, form.getType(), CaptchaService.class);
return service;
}
@ApiOperation("获取普通验证码:滑块验证码")
@GetMapping("/block-puzzle")
public CallBack<CaptchaVO> getBlockPuzzle() {
......@@ -46,7 +59,26 @@ public class CaptchaController {
log.info("获取验证码end,{}",vo);
return CallBack.success(vo);
}
@ApiOperation("校验验证码")
@GetMapping("/validate")
public CallBack<?> validate(CaptchaForm form){
log.info("验证码结果校验start");
CaptchaService service = getService(form);
service.validate(form);
log.info("验证码结果校验end");
return CallBack.success();
}
@ApiOperation("获取验证码方式")
@GetMapping("/all-type")
public Map<String,String> getAllType() {
return CaptchaTypeEnum.getMap();
}
@ApiOperation("获取验证码业务方式")
@GetMapping("/business-type")
public Map<String,String> getAllBusinessType() {
return CaptchaBusinessTypeEnum.getMap();
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论