mirror of
https://gitee.com/youlaitech/youlai-mall.git
synced 2024-12-23 05:00:25 +08:00
refactor: 删除文件
This commit is contained in:
parent
47f55f7d0c
commit
b164e8e9ab
16
.github/ISSUE_TEMPLATE/feature.md
vendored
16
.github/ISSUE_TEMPLATE/feature.md
vendored
@ -1,16 +0,0 @@
|
||||
---
|
||||
name: 建议增加新功能
|
||||
about: 请按照该模板填写,以便我们能真正了解你的需求,否则该 issue 将不予受理!
|
||||
---
|
||||
|
||||
## 功能描述
|
||||
|
||||
*请输入内容……*
|
||||
|
||||
## 原型图
|
||||
|
||||
*涉及到 UI 改动的功能,请一定提供原型图。原型图能表明功能即可,不要求规范和美观*
|
||||
|
||||
## 可参考的案例
|
||||
|
||||
*是否已有可参考的案例,有的话请给出链接*
|
27
.github/ISSUE_TEMPLATE/question.md
vendored
27
.github/ISSUE_TEMPLATE/question.md
vendored
@ -1,27 +0,0 @@
|
||||
---
|
||||
name: 使用时遇到了问题
|
||||
about: 请按照该模板填写,以便我们能真正了解你的问题,否则该 issue 将不予受理!
|
||||
---
|
||||
|
||||
## 问题描述
|
||||
|
||||
*请输入遇到的问题...*
|
||||
|
||||
## 项目版本
|
||||
|
||||
*请输入内容……*
|
||||
|
||||
## 是否查阅了文档 ?
|
||||
|
||||
(文档链接 [www.cnblogs.com/haoxianrui/](https://www.cnblogs.com/haoxianrui/) )
|
||||
|
||||
*是/否*
|
||||
|
||||
## 最小成本的复现步骤
|
||||
|
||||
(请告诉我们,如何**最快的**复现该问题?)
|
||||
|
||||
- 步骤一
|
||||
- 步骤二
|
||||
- 步骤三
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user