|
@@ -2,6 +2,8 @@ package org.springblade.gateway.goods_gateway.controller;
|
|
|
|
|
|
|
|
import cn.hutool.captcha.CaptchaUtil;
|
|
import cn.hutool.captcha.CaptchaUtil;
|
|
|
import cn.hutool.captcha.LineCaptcha;
|
|
import cn.hutool.captcha.LineCaptcha;
|
|
|
|
|
+import cn.hutool.captcha.generator.MathGenerator;
|
|
|
|
|
+import cn.hutool.captcha.generator.RandomGenerator;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
@@ -93,8 +95,9 @@ public class AppHelpGoodsController {
|
|
|
@ApiParam(value = "用户ID", required = true) @RequestParam Long userId,
|
|
@ApiParam(value = "用户ID", required = true) @RequestParam Long userId,
|
|
|
@ApiParam(value = "作品ID", required = true) @RequestParam Long productId) {
|
|
@ApiParam(value = "作品ID", required = true) @RequestParam Long productId) {
|
|
|
// 创建图像验证码
|
|
// 创建图像验证码
|
|
|
|
|
+ RandomGenerator randomGenerator = new RandomGenerator("0123456789", 4);
|
|
|
LineCaptcha lineCaptcha = CaptchaUtil.createLineCaptcha(250, 100);
|
|
LineCaptcha lineCaptcha = CaptchaUtil.createLineCaptcha(250, 100);
|
|
|
-// lineCaptcha.setGenerator(new ChineseGenerator(4));
|
|
|
|
|
|
|
+ lineCaptcha.setGenerator(randomGenerator);
|
|
|
// 重新生成code
|
|
// 重新生成code
|
|
|
lineCaptcha.createCode();
|
|
lineCaptcha.createCode();
|
|
|
// 创建验证码,并放到缓存中,有效期60秒
|
|
// 创建验证码,并放到缓存中,有效期60秒
|