Sfoglia il codice sorgente

发送,校验短信验证码更改

xuefy 4 anni fa
parent
commit
e2b4875cfe

+ 28 - 18
sc-service/src/main/java/com/huyi/service/credit/controller/OwnMessageController.java

@@ -137,21 +137,24 @@ public class OwnMessageController extends BaseController {
         String institutionId = configService.selectConfigByKey("cfca_institution_id").getMsg();
         //发送短信验证码
         JSONObject jsonObject =  CfcaUtil.sendSmsCode(false,institutionId,"",iphone,"");
-        //获取结果
-        String result = "";
-        try {
-            result = jsonObject.getString("Status");
-        }catch (Exception e){
+        Boolean success = jsonObject.has("Status");
+        if(success){
+            //获取结果
+            String result = jsonObject.getString("Status");
+            //手机号掩码
+            String newIphone = iphone.replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2");
+            Map<String,String > map = new HashMap<>();
+            //结果
+            map.put("result",result);
+            //掩码后的手机号
+            map.put("newIphone",newIphone);
+            return R.ok(map);
+        }else{
+            return R.fail(jsonObject.getString("Message"));
         }
 
-        //手机号掩码
-        String newIphone = iphone.replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2");
-        Map<String,String > map = new HashMap<>();
-        //结果
-        map.put("result",result);
-        //掩码后的手机号
-        map.put("newIphone",newIphone);
-        return R.ok(map);
+
+
     }
 
 
@@ -202,11 +205,18 @@ public class OwnMessageController extends BaseController {
         //机构编号
         String institutionId = configService.selectConfigByKey("cfca_institution_id").getMsg();
         JSONObject   jsonObject =   CfcaUtil.checkSmsCode(false,institutionId,iphone,validCode,"");
-        //获取结果
-        String verification = jsonObject.getString("Verification");
-        Map<String,String> map = new HashMap<>();
-        map.put("verification",verification);
-        return AjaxResult.success(map);
+
+
+        boolean success = jsonObject.has("Verification");
+        if (success) {
+            Map<String,String> map = new HashMap<>();
+            //获取结果
+            String verification = jsonObject.getString("Verification");
+            map.put("verification",verification);
+            return AjaxResult.success(map);
+        } else {
+            return AjaxResult.error(jsonObject.getString("Message"));
+        }
     }
 
     /**