| | |
| | | package com.ruoyi.project.common;
|
| | |
|
| | | import java.awt.image.BufferedImage;
|
| | | import java.io.IOException;
|
| | | import java.util.concurrent.TimeUnit;
|
| | | import jakarta.annotation.Resource;
|
| | | import javax.imageio.ImageIO;
|
| | | import jakarta.servlet.http.HttpServletResponse;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.beans.factory.annotation.Value;
|
| | | import org.springframework.util.FastByteArrayOutputStream;
|
| | | import org.springframework.web.bind.annotation.GetMapping;
|
| | | import org.springframework.web.bind.annotation.RestController;
|
| | | import com.google.code.kaptcha.Producer;
|
| | | import com.ruoyi.common.constant.CacheConstants;
|
| | | import com.ruoyi.common.constant.Constants;
|
| | |
| | | import com.ruoyi.framework.redis.RedisCache;
|
| | | import com.ruoyi.framework.web.domain.AjaxResult;
|
| | | import com.ruoyi.project.system.service.ISysConfigService;
|
| | | import jakarta.annotation.Resource;
|
| | | import jakarta.servlet.http.HttpServletResponse;
|
| | | import lombok.RequiredArgsConstructor;
|
| | | import org.springframework.beans.factory.annotation.Value;
|
| | | import org.springframework.util.FastByteArrayOutputStream;
|
| | | import org.springframework.web.bind.annotation.GetMapping;
|
| | | import org.springframework.web.bind.annotation.RestController;
|
| | |
|
| | | import javax.imageio.ImageIO;
|
| | | import java.awt.image.BufferedImage;
|
| | | import java.io.IOException;
|
| | | import java.util.concurrent.TimeUnit;
|
| | |
|
| | | /**
|
| | | * 验证码操作处理
|
| | |
| | | * @author ruoyi
|
| | | */
|
| | | @RestController
|
| | | @RequiredArgsConstructor
|
| | | public class CaptchaController
|
| | | {
|
| | | @Resource(name = "captchaProducer")
|
| | |
| | | @Resource(name = "captchaProducerMath")
|
| | | private Producer captchaProducerMath;
|
| | |
|
| | | @Autowired
|
| | | private RedisCache redisCache;
|
| | | private final RedisCache redisCache;
|
| | |
|
| | | // 验证码类型
|
| | | @Value("${ruoyi.captchaType}")
|
| | | private String captchaType;
|
| | |
|
| | | @Autowired
|
| | | private ISysConfigService configService;
|
| | | private final ISysConfigService configService;
|
| | |
|
| | | /**
|
| | | * 生成验证码
|