修复密码管理器获取拼音出错的bug
This commit is contained in:
parent
4524b6f2c3
commit
c7bcce309b
@ -5,7 +5,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class ToolsApplication {
|
||||
public static final String version="1.4.3";
|
||||
public static final String version="1.4.4.1";
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println("当前版本号:" + version);
|
||||
|
@ -456,14 +456,10 @@ public class Tools {
|
||||
}
|
||||
|
||||
public static String getPinYin(String text) {
|
||||
try {
|
||||
String pinyin = HttpTools.get("http://api.tianapi.com/pinyin/index?key=a1e0f7267037c4e0ea02fb1cb3912367&text=" + URLEncoder.encode(text, "UTF-8"));
|
||||
String pinyin = HttpTools.get("http://api.tianapi.com/pinyin/index?key=a1e0f7267037c4e0ea02fb1cb3912367&text=" + URLEncoder.encode(text, StandardCharsets.UTF_8));
|
||||
JSONObject json = JSONObject.parseObject(pinyin);
|
||||
if (json.getInteger("code") == 200) {
|
||||
return json.getJSONObject("newslist").getString("pinyin").trim().replace(" ", "");
|
||||
}
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
return json.getJSONArray("newslist").getJSONObject(0).getString("pinyin").trim().replace(" ", "");
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user