企业列表出来了

master
法外狂徒张三 2024-09-05 20:02:08 +08:00
parent 1b601222bc
commit b07cf2fcd9
3 changed files with 13 additions and 11 deletions

View File

@ -182,7 +182,7 @@
<workItem from="1725517357652" duration="1395000" /> <workItem from="1725517357652" duration="1395000" />
<workItem from="1725528983357" duration="20000" /> <workItem from="1725528983357" duration="20000" />
<workItem from="1725534330399" duration="6000" /> <workItem from="1725534330399" duration="6000" />
<workItem from="1725535072504" duration="1666000" /> <workItem from="1725535072504" duration="2629000" />
</task> </task>
<task id="LOCAL-00001" summary="初始化"> <task id="LOCAL-00001" summary="初始化">
<created>1724047244829</created> <created>1724047244829</created>
@ -415,7 +415,14 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1725536412572</updated> <updated>1725536412572</updated>
</task> </task>
<option name="localTasksCounter" value="34" /> <task id="LOCAL-00034" summary="企业列表出来了">
<created>1725537357138</created>
<option name="number" value="00034" />
<option name="presentableId" value="LOCAL-00034" />
<option name="project" value="LOCAL" />
<updated>1725537357138</updated>
</task>
<option name="localTasksCounter" value="35" />
<servers /> <servers />
</component> </component>
<component name="TypeScriptGeneratedFilesManager"> <component name="TypeScriptGeneratedFilesManager">

View File

@ -31,7 +31,7 @@ public class SimpleWeatherConfig {
params.put("city", cityName); params.put("city", cityName);
params.put("key", API_KEY); params.put("key", API_KEY);
String queryParams = urlencode(params); String queryParams = urlencode(params);
String msg = null;
String response = doGet(API_URL, queryParams); String response = doGet(API_URL, queryParams);
try { try {
JSONObject jsonObject = JSONObject.fromObject(response); JSONObject jsonObject = JSONObject.fromObject(response);
@ -49,15 +49,13 @@ public class SimpleWeatherConfig {
System.out.printf("风向:%s%n", realtime.getString("direct")); System.out.printf("风向:%s%n", realtime.getString("direct"));
System.out.printf("风力:%s%n", realtime.getString("power")); System.out.printf("风力:%s%n", realtime.getString("power"));
System.out.printf("空气质量:%s%n", realtime.getString("aqi")); System.out.printf("空气质量:%s%n", realtime.getString("aqi"));
msg = String.valueOf(realtime);
} else { } else {
System.out.println("调用接口失败:" + jsonObject.getString("reason")); System.out.println("调用接口失败:" + jsonObject.getString("reason"));
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
return msg; return response;
} }
/** /**

View File

@ -1,7 +1,5 @@
package com.muyu.market.config; package com.muyu.market.config;
import net.sf.json.JSONObject;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
@ -33,10 +31,9 @@ public class ThirdPartyConfig {
} }
in.close(); in.close();
connection.disconnect(); connection.disconnect();
JSONObject jsonObject = JSONObject.fromObject(response);
JSONObject result = jsonObject.getJSONObject("result");
// 返回HTTP 200 OK状态码和响应体 // 返回HTTP 200 OK状态码和响应体
return String.valueOf(result); return response.toString();
} }