Compare commits

..

No commits in common. "845b1b077e626cc0fb8b95f02b8382130599862a" and "63f1c9a54e2091c7073d6207026435f86db562b6" have entirely different histories.

View File

@ -74,18 +74,14 @@ public class ConfigServiceImpl implements ConfigService {
} }
private String getBingImg() { private String getBingImg() {
try { JSONObject bingObj = HttpUtil.getObj(bingHost + bingUrl, null, false);
JSONObject bingObj = HttpUtil.getObj(bingHost + bingUrl, null, false); String path = bingObj.getJSONArray("images").getJSONObject(0).getString("url");
String path = bingObj.getJSONArray("images").getJSONObject(0).getString("url"); String picUrl = bingHost + path;
String picUrl = bingHost + path; Request request = new Request.Builder().url(picUrl).build();
Request request = new Request.Builder().url(picUrl).build(); try (Response res = HttpUtil.getClient(false).newCall(request).execute()) {
try (Response res = HttpUtil.getClient(false).newCall(request).execute()) { byte[] bytes = res.body().bytes();
byte[] bytes = res.body().bytes(); String filePath = CommonConstant.fileSavePath + "/files/public/bing.jpg";
String filePath = CommonConstant.fileSavePath + "/files/public/bing.jpg"; FileUtil.writeBytes(bytes, filePath);
FileUtil.writeBytes(bytes, filePath);
} catch (Exception e) {
log.error("获取bing每日一图错误{}", e.getLocalizedMessage(), e);
}
} catch (Exception e) { } catch (Exception e) {
log.error("获取bing每日一图错误{}", e.getLocalizedMessage(), e); log.error("获取bing每日一图错误{}", e.getLocalizedMessage(), e);
} }