验证码方法 代码优化

(cherry picked from commit da5dac73ab)
This commit is contained in:
gaoxiongzaq 2023-07-22 08:53:50 +08:00 committed by 陈精华
parent ad322c2e10
commit 2b456c9934
1 changed files with 2 additions and 2 deletions

View File

@ -63,13 +63,13 @@ public class RandomValidateCodeUtil {
blue = random.nextInt(255);
// 用随机产生的颜色将验证码绘制到图像中
gd.setColor(new Color(red, green, blue));
gd.drawString(sessionCode, xx, codeY);
gd.drawString(sessionCode, 18, codeY);
randomCode.append(sessionCode);
}else {
// 随机产生codeCount数字的验证码
for (int i = 0; i < codeCount; i++) {
// 得到随机产生的验证码数字
String code = String.valueOf(codeSequence[random.nextInt(30)]);
String code = String.valueOf(codeSequence[random.nextInt(52)]);
// 产生随机的颜色分量来构造颜色值这样输出的每位数字的颜色值都将不同
red = random.nextInt(255);
green = random.nextInt(255);