deason 5 years ago
parent
commit
ed8557d22b

+ 4 - 5
examcloud-core-basic-base/src/main/java/cn/com/qmth/examcloud/core/basic/base/util/VerifyCode.java

@@ -50,13 +50,11 @@ public class VerifyCode {
                 .append(random.nextInt(10))
                 .append(OPS[random.nextInt(2)])
                 .append(random.nextInt(10))
-                .append(OPS[random.nextInt(2)])
-                .append(random.nextInt(10))
                 .toString();
 
         graphics.setColor(new Color(0, 0, 255));
         graphics.setFont(new Font("宋体", Font.BOLD, 22));
-        graphics.drawString(verifyCode, 15, 24);
+        graphics.drawString(verifyCode, 12, 28);
         graphics.dispose();
 
         Integer result;
@@ -120,16 +118,17 @@ public class VerifyCode {
         final String dir = "/home/verifyCodes";
         new File(dir).mkdirs();
 
-        for (int n = 1; n <= 1; n++) {
+        for (int n = 1; n <= 10; n++) {
             Result result = VerifyCode.generateVerifyCode();
 
             final String imgPath = String.format("Img_%s.jpg", n);
             File imgFile = new File(dir + "/" + imgPath);
             ImageIO.write(result.getImage(), "JPEG", imgFile);
+            System.out.println(result.getResult());
 
             byte[] bytes = imageToBytes(result.getImage());
             String base64 = Base64Utils.encodeToString(bytes);
-            System.out.println(base64);
+            System.out.println(base64 + "\n");
         }
     }*/