|
@@ -60,7 +60,20 @@ public class HttpClientUtils {
|
|
|
}
|
|
|
|
|
|
public static String doGet(String url, Map<String, String> paramMap) throws IOException {
|
|
|
- url += "?appid=" + paramMap.get("appid") + "&secret=" + paramMap.get("secret") + "&js_code=" + paramMap.get("js_code") + "&grant_type=" + paramMap.get("grant_type");
|
|
|
+ //url += "?appid=" + paramMap.get("appid") + "&secret=" + paramMap.get("secret") + "&js_code=" + paramMap.get("js_code") + "&grant_type=" + paramMap.get("grant_type");
|
|
|
+
|
|
|
+ int i = 1;
|
|
|
+ if(!paramMap.isEmpty()){
|
|
|
+ for (Map.Entry<String, String> stringStringEntry : paramMap.entrySet()) {
|
|
|
+ if(i==1){
|
|
|
+ url = url + "?" + stringStringEntry.getKey() +"="+ stringStringEntry.getValue();
|
|
|
+ }else{
|
|
|
+ url = url + "&" + stringStringEntry.getKey() +"="+ stringStringEntry.getValue();
|
|
|
+ }
|
|
|
+ i++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// 创建Httpclient对象
|
|
|
CloseableHttpClient httpClient = HttpClients.createDefault();
|
|
|
CloseableHttpResponse response = null;
|