refactor: 删除文件

This commit is contained in:
郝先瑞 2022-05-17 21:46:06 +08:00
parent 47f55f7d0c
commit b164e8e9ab
4 changed files with 0 additions and 115 deletions

View File

@ -1,16 +0,0 @@
---
name: 建议增加新功能
about: 请按照该模板填写,以便我们能真正了解你的需求,否则该 issue 将不予受理!
---
## 功能描述
*请输入内容……*
## 原型图
*涉及到 UI 改动的功能,请一定提供原型图。原型图能表明功能即可,不要求规范和美观*
## 可参考的案例
*是否已有可参考的案例,有的话请给出链接*

View File

@ -1,27 +0,0 @@
---
name: 使用时遇到了问题
about: 请按照该模板填写,以便我们能真正了解你的问题,否则该 issue 将不予受理!
---
## 问题描述
*请输入遇到的问题...*
## 项目版本
*请输入内容……*
## 是否查阅了文档
(文档链接 [www.cnblogs.com/haoxianrui/](https://www.cnblogs.com/haoxianrui/)
*是/否*
## 最小成本的复现步骤
(请告诉我们,如何**最快的**复现该问题?)
- 步骤一
- 步骤二
- 步骤三

View File

@ -1,72 +0,0 @@
package com.youlai.gateway.util;
import com.google.code.kaptcha.text.impl.DefaultTextCreator;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
/**
* 验证码文本生成器
*
* @author <a href="mailto:xianrui0365@163.com">haoxr</a>
* @date 2021/10/4
*/
public class KaptchaTextCreator extends DefaultTextCreator {
private static final String[] CNUMBERS = "0,1,2,3,4,5,6,7,8,9,10".split(",");
// https://gitee.com/youlaitech/youlai-mall/issues/I4E0WL?from=project-issue
// private SecureRandom random = SecureRandom.getInstanceStrong(); // /dev/random 作为熵池熵越大随机性越好熵池数量不足就会阻塞线程适用随机数比较高的请求
private SecureRandom random = new SecureRandom(); // /dev/urandom 作为熵池非阻塞的随机数生成器重复使用熵池中的数据以产生伪随机数据不会产生阻塞适用生成较低强度的伪随机数
public KaptchaTextCreator() throws NoSuchAlgorithmException {
}
@Override
public String getText() {
Integer result = 0;
int x = this.random.nextInt(10);
int y = this.random.nextInt(10);
StringBuilder suChinese = new StringBuilder();
int randomoperands = (int) Math.round(random.nextDouble() * 2);
if (randomoperands == 0) {
result = x * y;
suChinese.append(CNUMBERS[x]);
suChinese.append("*");
suChinese.append(CNUMBERS[y]);
} else if (randomoperands == 1) {
if (!(x == 0) && y % x == 0) {
result = y / x;
suChinese.append(CNUMBERS[y]);
suChinese.append("/");
suChinese.append(CNUMBERS[x]);
} else {
result = x + y;
suChinese.append(CNUMBERS[x]);
suChinese.append("+");
suChinese.append(CNUMBERS[y]);
}
} else if (randomoperands == 2) {
if (x >= y) {
result = x - y;
suChinese.append(CNUMBERS[x]);
suChinese.append("-");
suChinese.append(CNUMBERS[y]);
} else {
result = y - x;
suChinese.append(CNUMBERS[y]);
suChinese.append("-");
suChinese.append(CNUMBERS[x]);
}
} else {
result = x + y;
suChinese.append(CNUMBERS[x]);
suChinese.append("+");
suChinese.append(CNUMBERS[y]);
}
suChinese.append("=?@" + result);
return suChinese.toString();
}
}