| | |
| | | |
| | | import java.awt.image.BufferedImage; |
| | | import java.io.IOException; |
| | | import java.util.HashMap; |
| | | import java.util.concurrent.TimeUnit; |
| | | import javax.annotation.Resource; |
| | | import javax.imageio.ImageIO; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.FastByteArrayOutputStream; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @Slf4j |
| | | public class CaptchaController |
| | | { |
| | | @Resource(name = "captchaProducer") |
| | |
| | | { |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | boolean captchaEnabled = configService.selectCaptchaEnabled(); |
| | | ajax.put("captchaEnabled", captchaEnabled); |
| | | if (!captchaEnabled) |
| | | { |
| | | return ajax; |
| | |
| | | return AjaxResult.error(e.getMessage()); |
| | | } |
| | | |
| | | ajax.put("uuid", uuid); |
| | | ajax.put("img", Base64.encode(os.toByteArray())); |
| | | ajax.put("code",200); |
| | | ajax.put("value",code); |
| | | ajax.put("txt","77777"); |
| | | HashMap<String, Object> data = new HashMap<>(); |
| | | data.put("uuid",uuid); |
| | | data.put("img",Base64.encode(os.toByteArray())); |
| | | data.put("value",code); |
| | | data.put("txt","77777"); |
| | | ajax.put("msg","操作成功"); |
| | | ajax.put("data",data); |
| | | |
| | | log.info("value:{}",code); |
| | | return ajax; |
| | | } |
| | | } |