@@ -157,7 +157,14 @@ public void network(final String jsParams) {
157157 return ;
158158 }
159159 try {
160- JSONObject jsJsonObj = new JSONObject (jsParams );
160+ JSONObject msgJsonObj = new JSONObject (jsParams );
161+ if (msgJsonObj == null ) {
162+ return ;
163+ }
164+ JSONObject jsJsonObj = msgJsonObj .optJSONObject ("msg" );
165+ if (jsJsonObj == null ) {
166+ return ;
167+ }
161168 String url = jsJsonObj .optString ("url" );
162169 String method = jsJsonObj .optString ("method" );
163170 Map <String , String > param = VenvyMapUtil .jsonToMap (jsJsonObj .optString ("param" ));
@@ -178,15 +185,25 @@ public void network(final String jsParams) {
178185 public void requestFinish (Request request , IResponse response ) {
179186 if (response .isSuccess ()) {
180187 String result = response .getResult ();
181- callJsFunction (result , jsParams );
188+ try {
189+ JSONObject obj = new JSONObject (result );
190+ callJsFunction (obj .toString (), jsParams );
191+ } catch (Exception e ) {
192+ e .printStackTrace ();
193+ }
182194 } else {
183195 requestError (request , new Exception ("http not successful" ));
184196 }
185197 }
186198
187199 @ Override
188200 public void requestError (Request request , @ Nullable Exception e ) {
189- callJsFunction (e != null && e .getMessage () != null ? e .getMessage () : "unkown error" , jsParams );
201+ try {
202+ JSONObject object = new JSONObject (e != null && e .getMessage () != null ? e .getMessage () : "unkown error" );
203+ callJsFunction (object .toString (), jsParams );
204+ } catch (Exception exception ) {
205+ exception .printStackTrace ();
206+ }
190207 }
191208
192209 @ Override
0 commit comments