log.info("DEBUG --->" + singleStatusResponse);
tempParams.clear();
MessageResponse msgResponse = JSON.decode(singleStatusResponse, MessageResponse.class);
if (msgResponse.isOK()) {
if (msgResponse.getData() != null) {
Date sinceDate = msgResponse.getData().getTimestamp();
tempParams.putAll(params);
tempParams.put("pageflag", "2");
//tempParams.put("reqnum", "0");
//tempParams.put("lastid", "0");
tempParams.put("pagetime", Long.toString(sinceDate.getTime()));
} else {
//FIXME
tempParams.putAll(params);
tempParams.put("reqnum", "1");
}
} else {
throw new RuntimeException(singleStatusResponse);
}
} else {
tempParams.putAll(params);
tempParams.put("reqnum", this.configMap.get("qq.broadcast.timeline.reqnum"));
}
tempParams.put("type", "1");
String timeline_url = "http://open.t.qq.com/api/statuses/broadcast_timeline_ids";
String final_timeline_url = getSignedURL(Constants.HTTP_GET, timeline_url, tempParams);
log.info("final_timeline_url -->" + final_timeline_url);
String response = HttpClient.doGet(final_timeline_url);
log.info("DEBUG --> " + response);
TimelineResponse timelineResponse = JSON.decode(response, TimelineResponse.class);
if (timelineResponse != null && timelineResponse.isOK()) {
for (TimelineData.Info timelineInfo : timelineResponse.getData().getInfo()) {
tempParams.clear();
tempParams.put("format", "json");
tempParams.put("id", timelineInfo.getId());
tempParams.putAll(getFixedParams());
String url = "http://open.t.qq.com/api/t/show";
String final_url = getSignedURL(Constants.HTTP_GET, url, tempParams);
log.info("final_url -->" + final_url);
String singleStatusResponse = HttpClient.doGet(final_url);
log.info("DEBUG --> " + singleStatusResponse);
MessageResponse msgResponse = JSON.decode(singleStatusResponse, MessageResponse.class);
if (msgResponse.isOK()) {
result.add(msgResponse);
} else {
MessageData data = new MessageData();
data.setId(timelineInfo.getId());
data.setTimestamp(timelineInfo.getTimestamp());
msgResponse.setData(data);
result.add(msgResponse);
}
}
}