Commit 31b11eff by win 10

修复用户不存在时的问题

parent e30d8b32
...@@ -37,6 +37,8 @@ public class XinLangCaiJing { ...@@ -37,6 +37,8 @@ public class XinLangCaiJing {
try(Response response = httpBoot.syncCall(RequestUtils.wrapGet(jsonUrl),proxy)) { try(Response response = httpBoot.syncCall(RequestUtils.wrapGet(jsonUrl),proxy)) {
String htmlBody = response.body().string(); String htmlBody = response.body().string();
JSONObject json = JSONObject.parseObject(htmlBody); JSONObject json = JSONObject.parseObject(htmlBody);
if(!json.getJSONObject("result").getJSONObject("data").toString().contains("用户不存在")) {
JSONArray jsonArray = json.getJSONObject("result").getJSONObject("data").getJSONArray("lists"); JSONArray jsonArray = json.getJSONObject("result").getJSONObject("data").getJSONArray("lists");
int totalpage = json.getJSONObject("result").getJSONObject("data").getInteger("totalpage");//总页数 int totalpage = json.getJSONObject("result").getJSONObject("data").getInteger("totalpage");//总页数
...@@ -71,13 +73,15 @@ public class XinLangCaiJing { ...@@ -71,13 +73,15 @@ public class XinLangCaiJing {
dataList.add(dataMap); dataList.add(dataMap);
} }
} }
if(page < totalpage) { if(page < totalpage) {
nextPage = true; nextPage = true;
page ++; page ++;
}else { }else {
nextPage = false; nextPage = false;
} }
}else {
nextPage = false;
}
} catch (Exception e) { } catch (Exception e) {
logger.error("获取新浪财经头条数据失败 {}", e); logger.error("获取新浪财经头条数据失败 {}", e);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment