Browse Source

验证码生成规则修改

andy 7 months ago
parent
commit
d280b7cf76

+ 8 - 6
mainFactory/src/main/java/org/bfkj/application/AuthApplicationImpl.java

@@ -203,14 +203,16 @@ public class AuthApplicationImpl {
         if (Objects.isNull(appRule)) {
             return processFail("无需验证码");
         }
+        if (appRule.toString().trim().isEmpty()) {
+            return processFail("验证码规则不存在");
+        }
         String codeFormat = "";
         //codeType == 1 ? "0123456789" : "0123456789ACDEFGHJKLMNPQRSTWXY"
         if (appRule.toString().contains("A")) {
-            codeFormat = codeFormat + "ACDEFGHJKLMNPQRSTWXY";
-        } else if (appRule.toString().contains("N")) {
-            codeFormat = codeFormat + "0123456789";
-        } else {
-            return processFail("验证码规则不存在");
+            codeFormat += "ACDEFGHJKLMNPQRSTWXY";
+        }
+        if (appRule.toString().contains("N")) {
+            codeFormat += "0123456789";
         }
         // 生成验证码
         String appRuleStr = appRule.toString();  //A2N4
@@ -266,7 +268,7 @@ public class AuthApplicationImpl {
         List<Map<String, Object>> applicationList = MapTools.getMapList(applicationLogin);
         if (! applicationLogin.get("code").equals("0")) {
             return processFail("校验验证码,执行错误");
-        }else{
+        } else {
             myDbHelper.updateByCondition("update t_application_login set app_code = null where app_token=?", null,
                                          app_token);
         }