Explorar o código

测试工商银行 支付 可能会编译失败

wuxw %!s(int64=3) %!d(string=hai) anos
pai
achega
6e439e8cc4

+ 17 - 8
java110-core/src/main/java/com/java110/core/factory/CallApiServiceFactory.java

@@ -158,12 +158,17 @@ public class CallApiServiceFactory {
         }
 
         JSONObject resultVo = JSONObject.parseObject(responseEntity.getBody());
-
-        if (ResultVo.CODE_MACHINE_OK != resultVo.getInteger("code")) {
-            throw new SMOException(resultVo.getString("msg"));
+        Object bObj = null;
+        if(resultVo.containsKey("code")){
+            if (ResultVo.CODE_MACHINE_OK != resultVo.getInteger("code")) {
+                throw new SMOException(resultVo.getString("msg"));
+            }
+            bObj = resultVo.get("data");
+        }else{
+            bObj = resultVo;
         }
 
-        Object bObj = resultVo.get("data");
+
         JSONArray datas = null;
         if (bObj instanceof JSONObject) {
             datas = new JSONArray();
@@ -209,11 +214,15 @@ public class CallApiServiceFactory {
 
         JSONObject resultVo = JSONObject.parseObject(responseEntity.getBody());
 
-        if (!"0".equals(resultVo.getString("code"))) {
-            throw new SMOException(resultVo.getString("msg"));
+        Object bObj = null;
+        if(resultVo.containsKey("code")){
+            if (ResultVo.CODE_MACHINE_OK != resultVo.getInteger("code")) {
+                throw new SMOException(resultVo.getString("msg"));
+            }
+            bObj = resultVo.get("data");
+        }else{
+            bObj = resultVo;
         }
-
-        Object bObj = resultVo.get("data");
         JSONArray datas = null;
         if (bObj instanceof JSONObject) {
             datas = new JSONArray();