From 1b601222bc192ef3dba091bcb09d3bd881744883 Mon Sep 17 00:00:00 2001
From: Wang YiHang <3060234389@qq.com>
Date: Thu, 5 Sep 2024 19:55:55 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BC=81=E4=B8=9A=E5=88=97=E8=A1=A8=E5=87=BA?=
=?UTF-8?q?=E6=9D=A5=E4=BA=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.idea/workspace.xml | 14 ++++++++++++--
.../muyu/market/config/SimpleWeatherConfig.java | 2 +-
.../com/muyu/market/config/ThirdPartyConfig.java | 7 +++++--
3 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index b8d16ae..c3e01ba 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -9,6 +9,9 @@
+
+
+
@@ -179,7 +182,7 @@
-
+
1724047244829
@@ -405,7 +408,14 @@
1725535995757
-
+
+ 1725536412572
+
+
+
+ 1725536412572
+
+
diff --git a/cloud-market-common/src/main/java/com/muyu/market/config/SimpleWeatherConfig.java b/cloud-market-common/src/main/java/com/muyu/market/config/SimpleWeatherConfig.java
index 8d263c2..3750707 100644
--- a/cloud-market-common/src/main/java/com/muyu/market/config/SimpleWeatherConfig.java
+++ b/cloud-market-common/src/main/java/com/muyu/market/config/SimpleWeatherConfig.java
@@ -50,7 +50,7 @@ public class SimpleWeatherConfig {
System.out.printf("风力:%s%n", realtime.getString("power"));
System.out.printf("空气质量:%s%n", realtime.getString("aqi"));
- msg = String.valueOf(result);
+ msg = String.valueOf(realtime);
} else {
System.out.println("调用接口失败:" + jsonObject.getString("reason"));
}
diff --git a/cloud-market-common/src/main/java/com/muyu/market/config/ThirdPartyConfig.java b/cloud-market-common/src/main/java/com/muyu/market/config/ThirdPartyConfig.java
index 38f64a8..9ea644b 100644
--- a/cloud-market-common/src/main/java/com/muyu/market/config/ThirdPartyConfig.java
+++ b/cloud-market-common/src/main/java/com/muyu/market/config/ThirdPartyConfig.java
@@ -1,5 +1,7 @@
package com.muyu.market.config;
+import net.sf.json.JSONObject;
+
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
@@ -31,9 +33,10 @@ public class ThirdPartyConfig {
}
in.close();
connection.disconnect();
-
+ JSONObject jsonObject = JSONObject.fromObject(response);
+ JSONObject result = jsonObject.getJSONObject("result");
// 返回HTTP 200 OK状态码和响应体
- return response.toString();
+ return String.valueOf(result);
}