| | |
| | | }
|
| | | String code = jsonResult.get("code").getAsString();
|
| | | if (!"0".equals(code)) {
|
| | | try {
|
| | | String msg = jsonResult.get("msg").getAsString();
|
| | | throw new BusinessException(code + msg);
|
| | | }catch (Exception exception){
|
| | | String msg = jsonResult.get("message").getAsString();
|
| | | throw new BusinessException(code + msg);
|
| | | }
|
| | | }
|
| | |
|
| | | JsonObject jsonData = new JsonObject();
|
| | |
| | | LogUtil.debugLog(TAG, "reqest: " + url + " data:" + json);
|
| | | String openApi = HttpClient.post(url, json, "application/json", "OpenApi",timeOut);
|
| | | LogUtil.debugLog(TAG, "返回结果: \r\n" + openApi);
|
| | | try {
|
| | | jsonObject = new JsonParser().parse(openApi).getAsJsonObject();
|
| | | }catch (Exception exception){
|
| | | jsonObject = new Gson().fromJson(openApi,JsonObject.class);
|
| | | }
|
| | | } catch (IOException e) {
|
| | | BusinessException b = new BusinessException(e);
|
| | | if (e instanceof ConnectTimeoutException || e instanceof SocketTimeoutException
|