From b164e8e9ab035a3a24007a74f75e5d9318eae495 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=9D=E5=85=88=E7=91=9E?= <1490493387@qq.com> Date: Tue, 17 May 2022 21:46:06 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E5=88=A0=E9=99=A4=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/ISSUE_TEMPLATE/feature.md | 16 ----- .github/ISSUE_TEMPLATE/question.md | 27 ------- youlai-common/common-elasticsearch/README.md | 0 .../gateway/util/KaptchaTextCreator.java | 72 ------------------- 4 files changed, 115 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/feature.md delete mode 100644 .github/ISSUE_TEMPLATE/question.md delete mode 100644 youlai-common/common-elasticsearch/README.md delete mode 100644 youlai-gateway/src/main/java/com/youlai/gateway/util/KaptchaTextCreator.java diff --git a/.github/ISSUE_TEMPLATE/feature.md b/.github/ISSUE_TEMPLATE/feature.md deleted file mode 100644 index 60709ea63..000000000 --- a/.github/ISSUE_TEMPLATE/feature.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -name: 建议增加新功能 -about: 请按照该模板填写,以便我们能真正了解你的需求,否则该 issue 将不予受理! ---- - -## 功能描述 - -*请输入内容……* - -## 原型图 - -*涉及到 UI 改动的功能,请一定提供原型图。原型图能表明功能即可,不要求规范和美观* - -## 可参考的案例 - -*是否已有可参考的案例,有的话请给出链接* diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md deleted file mode 100644 index 7b2de9dc5..000000000 --- a/.github/ISSUE_TEMPLATE/question.md +++ /dev/null @@ -1,27 +0,0 @@ ---- -name: 使用时遇到了问题 -about: 请按照该模板填写,以便我们能真正了解你的问题,否则该 issue 将不予受理! ---- - -## 问题描述 - -*请输入遇到的问题...* - -## 项目版本 - -*请输入内容……* - -## 是否查阅了文档 ? - -(文档链接 [www.cnblogs.com/haoxianrui/](https://www.cnblogs.com/haoxianrui/) ) - -*是/否* - -## 最小成本的复现步骤 - -(请告诉我们,如何**最快的**复现该问题?) - -- 步骤一 -- 步骤二 -- 步骤三 - diff --git a/youlai-common/common-elasticsearch/README.md b/youlai-common/common-elasticsearch/README.md deleted file mode 100644 index e69de29bb..000000000 diff --git a/youlai-gateway/src/main/java/com/youlai/gateway/util/KaptchaTextCreator.java b/youlai-gateway/src/main/java/com/youlai/gateway/util/KaptchaTextCreator.java deleted file mode 100644 index 4862898fa..000000000 --- a/youlai-gateway/src/main/java/com/youlai/gateway/util/KaptchaTextCreator.java +++ /dev/null @@ -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 haoxr - * @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(); - } - -}