|
@@ -360,10 +360,11 @@ public class live extends Controller {
|
|
|
*/
|
|
|
public String getRealTimeViewers() {
|
|
|
String channelid = content.getString("channelid");
|
|
|
- String sql = "SELECT [count] FROM tlive_usercount WHERE [time]='" + getDateTime_Str() + "' AND channelid='" + channelid + "'";
|
|
|
+ //String sql = "SELECT [count] FROM tlive_usercount WHERE [time]='" + getDateTime_Str() + "' AND channelid='" + channelid + "'";
|
|
|
+ String sql = "select channelid,count as fcustcount from (select ROW_NUMBER()over(partition by t1.channelid order by t1.time desc)as num,t1.channelid,t1.count from tlive_usercount t1 where t1. channelid='" + channelid + "')t where t.num=1";
|
|
|
Rows rows = dbConnect.runSqlQuery(sql);
|
|
|
JSONObject resultObject = new JSONObject();
|
|
|
- resultObject.put("count", rows.isEmpty() ? 0 : rows.get(0).getLong("count"));
|
|
|
+ resultObject.put("count", rows.isEmpty() ? 0 : rows.get(0).getLong("fcustcount"));
|
|
|
return getSucReturnObject().setData(resultObject).toString();
|
|
|
}
|
|
|
|
|
@@ -374,7 +375,7 @@ public class live extends Controller {
|
|
|
*/
|
|
|
public String getRealTimeViewerList() {
|
|
|
String channelid = content.getString("channelid");
|
|
|
- Long lastmodified = getDateTime().getTime() / 1000- 5* 60;
|
|
|
+ Long lastmodified = getDateTime().getTime() / 1000 - 5 * 60;
|
|
|
System.err.println(lastmodified);
|
|
|
SQLFactory sqlFactory = new SQLFactory(this, "实时观众列表", pageSize, pageNumber, "t1.tlive_viewlogid DESC");
|
|
|
sqlFactory.addParameter("channelid", channelid);
|
|
@@ -417,7 +418,7 @@ public class live extends Controller {
|
|
|
sqlFactory.addParameter_in("tagentsidList", tagentsidList);
|
|
|
Rows agentRows = dbConnect.runSqlQuery(sqlFactory.getSQL());
|
|
|
|
|
|
- for(Row row:agentRows){
|
|
|
+ for (Row row : agentRows) {
|
|
|
//观看次数(次)
|
|
|
String channelid = row.getString("channelid");
|
|
|
//观看人数(人)
|
|
@@ -426,8 +427,6 @@ public class live extends Controller {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
return getSucReturnObject().setData(agentRows).toString();
|
|
|
}
|
|
|
|