Map<String, String> params = getRequestParams(phoneNumber);
FormBody.Builder builder = new FormBody.Builder();
for (Map.Entry<String, String> entry : params.entrySet()) {
builder.add(entry.getKey(), entry.getValue() != null ? entry.getValue() : "");
}
Request request = new Request.Builder().url(GetClueCityServant.GET_CLUE_CITY_URL).post(builder.build()).build();
OkHttpClient client = new OkHttpClient();
Call call = client.newCall(request);
try {
Response response = call.execute();
if (response != null && response.isSuccessful() && response.body() != null) {
mResult = parseData(response.body().string());
} else {
LogUtil.e(TAG, "同步请求接口失败");
}
} catch (IOException e1) {
e1.printStackTrace();
} finally {
client.dispatcher().cancelAll();
}
05-31
2515
05-22
2117