修复算数验证码生成BUG

This commit is contained in:
2026-08-06 17:32:55 +08:00
parent 68dbec4aea
commit 21729c94f1
@@ -145,7 +145,11 @@ public class SysLoginServiceImpl implements SysLoginService {
redisService.set(cacheParam.key(uid), arithmeticDto.getResult(), cacheParam.expireTime());
// 转换为base64的验证码
return "data:image/png;base64," + new String(Base64Utils.encode(imgCode) == null ? new byte[0] : imgCode);
byte[] encode = Base64Utils.encode(imgCode);
if (BytesUtils.isEmpty(encode)) {
throw new BizError("验证码生成失败");
}
return "data:image/png;base64," + new String(encode);
}
/**