升级Es驱动版本
This commit is contained in:
@@ -277,6 +277,39 @@ public class BaiDuApiUtils {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param coords
|
||||
* @param from
|
||||
* @return
|
||||
*/
|
||||
public static JSONObject geoconv(String coords,int from){
|
||||
Map<String,String> params = new HashMap<String, String>();
|
||||
params.put("output", "json");
|
||||
params.put("ak", AK);
|
||||
params.put("coords", coords);
|
||||
params.put("from", String.valueOf(from));
|
||||
HttpRequest request = new HttpRequest();
|
||||
try{
|
||||
String result = request.get("http://api.map.baidu.com/geoconv/v1/",params,"UTF-8");
|
||||
JSONObject json = JSONObject.fromObject(result);
|
||||
while(!(json == null || json.containsKey("result") || json.getJSONArray("result").size() == 0)){
|
||||
changeAK();
|
||||
result = request.get("http://api.map.baidu.com/geoconv/v1/",params,"UTF-8");
|
||||
json = JSONObject.fromObject(result);
|
||||
Thread.sleep(1000 * 60);
|
||||
}
|
||||
if(json.getInt("status") >= 300){
|
||||
changeAK();
|
||||
json = geoconv(coords, from);
|
||||
}
|
||||
return json.getJSONArray("result").getJSONObject(0);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static JSONObject geoconv(String coords, int from, int to){
|
||||
Map<String,String> params = new HashMap<String, String>();
|
||||
|
||||
Reference in New Issue
Block a user