fix(sso): 修复ICaptcha强制转换为CircleCaptcha调用getImage()

ICaptcha接口没有getImage()方法,需要强制转换为CircleCaptcha

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
liulujian 2026-04-15 16:01:00 +08:00
parent 8a91713bab
commit 0d6c3e353a

View File

@ -61,12 +61,13 @@ public class VerifyServiceImpl implements VerifyService {
@Override
public CommonResult<Map<String, String>> getCaptcha(String remoteId) {
String code = lineCaptcha.getCode();
cn.hutool.captcha.CircleCaptcha circleCaptcha = (cn.hutool.captcha.CircleCaptcha) lineCaptcha;
String code = circleCaptcha.getCode();
String uuid = IdUtil.fastSimpleUUID();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
ImageIO.write(lineCaptcha.getImage(), "png", baos);
ImageIO.write(circleCaptcha.getImage(), "png", baos);
} catch (IOException e) {
throw new RuntimeException("生成验证码图片失败", e);
}