|
@@ -2,7 +2,6 @@ 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.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;
|
|
@@ -94,12 +93,13 @@ 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) {
|
|
|
// 自定义纯数字的验证码(随机4位数字,可重复)
|
|
// 自定义纯数字的验证码(随机4位数字,可重复)
|
|
|
- RandomGenerator randomGenerator = new RandomGenerator("0123456789", 4);
|
|
|
|
|
|
|
+// RandomGenerator randomGenerator = new RandomGenerator("0123456789", 4);
|
|
|
|
|
+ // 创建图像验证码
|
|
|
LineCaptcha lineCaptcha = CaptchaUtil.createLineCaptcha(200, 100);
|
|
LineCaptcha lineCaptcha = CaptchaUtil.createLineCaptcha(200, 100);
|
|
|
- lineCaptcha.setGenerator(randomGenerator);
|
|
|
|
|
|
|
+// lineCaptcha.setGenerator(randomGenerator);
|
|
|
// 重新生成code
|
|
// 重新生成code
|
|
|
lineCaptcha.createCode();
|
|
lineCaptcha.createCode();
|
|
|
- //创建验证码,并放到缓存中,有效期60秒
|
|
|
|
|
|
|
+ // 创建验证码,并放到缓存中,有效期60秒
|
|
|
bladeRedis.setEx(HelpGoodsConstant.getVerificationCodeKey(userId, productId, helpGoodsId), lineCaptcha.getCode(), HelpGoodsConstant.HELP_GOODS_VERIFICATION_CODE_EXIST_TIME);
|
|
bladeRedis.setEx(HelpGoodsConstant.getVerificationCodeKey(userId, productId, helpGoodsId), lineCaptcha.getCode(), HelpGoodsConstant.HELP_GOODS_VERIFICATION_CODE_EXIST_TIME);
|
|
|
return R.data(lineCaptcha.getImageBase64Data());
|
|
return R.data(lineCaptcha.getImageBase64Data());
|
|
|
}
|
|
}
|