deason 5 年之前
父节点
当前提交
f6d7f25fa5

+ 4 - 2
examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/impl/VerifyCodeServiceImpl.java

@@ -20,6 +20,7 @@ import org.apache.commons.codec.binary.Base64;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.util.Base64Utils;
 
 /**
  * 验证码相关接口
@@ -58,6 +59,7 @@ public class VerifyCodeServiceImpl implements VerifyCodeService {
         VerifyCode.Result result = VerifyCode.generateVerifyCode();
         byte[] bytes = VerifyCode.imageToBytes(result.getImage());
         String base64 = Base64.encodeBase64String(bytes);
+        String base642 = Base64Utils.encodeToString(bytes);
         String uuid = UUID.randomUUID();
 
         log.info(String.format("accountValue = %s, uuid = %s, verifyCode = %s", accountValue, uuid, result.getResult()));
@@ -70,9 +72,9 @@ public class VerifyCodeServiceImpl implements VerifyCodeService {
 
         log.info(base64);
         log.info("=========");
-        log.info(uuid + base64);
+        log.info(base642);
 
-        return base64;
+        return uuid + base642;
     }
 
     /**