diff --git a/src/main/java/com/yutou/tools/ToolsApplication.java b/src/main/java/com/yutou/tools/ToolsApplication.java index aed4bd8..713d295 100644 --- a/src/main/java/com/yutou/tools/ToolsApplication.java +++ b/src/main/java/com/yutou/tools/ToolsApplication.java @@ -6,7 +6,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class ToolsApplication { - public static final String version="1.5.0"; + public static final String version="1.5.1"; public static void main(String[] args) { System.out.println("当前版本号:" + version); diff --git a/src/main/java/com/yutou/tools/utils/Tools.java b/src/main/java/com/yutou/tools/utils/Tools.java index 6fda890..82bec8d 100644 --- a/src/main/java/com/yutou/tools/utils/Tools.java +++ b/src/main/java/com/yutou/tools/utils/Tools.java @@ -462,7 +462,7 @@ public class Tools { String pinyin = HttpTools.get("https://apis.tianapi.com/pinyin/index?key=" + ConfigTools.load(ConfigTools.CONFIG, "tianapi.key", String.class) + "&text=" + URLEncoder.encode(text, StandardCharsets.UTF_8)); JSONObject json = JSONObject.parseObject(pinyin); if (json.getInteger("code") == 200) { - return json.getJSONArray("newslist").getJSONObject(0).getString("pinyin").trim().replace(" ", ""); + return json.getJSONObject("result").getString("pinyin").trim().replace(" ", ""); } return ""; } @@ -488,4 +488,8 @@ public class Tools { return null; } } + + public static void main(String[] args) { + System.out.println(getPinYin("你好")); + } }