|
|
@@ -90,6 +90,96 @@ public class live extends Controller {
|
|
|
return getSucReturnObject().setData(rows).toString();
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 直播数据统计(频道)
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public String getLiveDataCount() {
|
|
|
+ String channelid = content.getString("channelid");
|
|
|
+ JSONObject resultObject = new JSONObject();
|
|
|
+ //观看次数(次)
|
|
|
+ double viewCounts = getCount("观看次数", "num", channelid);
|
|
|
+ resultObject.put("viewCounts", String.format("%.2f", viewCounts));
|
|
|
+ //观看时长(分钟)
|
|
|
+ double viewDuration = getCount("观看时长", "num", channelid);
|
|
|
+ resultObject.put("viewDuration", String.format("%.2f", viewDuration));
|
|
|
+ //观看人数(人)
|
|
|
+ double viewers = getCount("观看人数", "num", channelid);
|
|
|
+ resultObject.put("viewers", String.format("%.2f", viewers));
|
|
|
+ //人均观看次数(次)
|
|
|
+ resultObject.put("viewCountsAvg", String.format("%.2f", viewers == 0.0 ? 0 : viewCounts / viewers));
|
|
|
+ //人均观看时长(分钟)
|
|
|
+ resultObject.put("viewDurationAvg", String.format("%.2f", viewers == 0.0 ? 0 : viewDuration / viewers));
|
|
|
+
|
|
|
+ return getSucReturnObject().setData(resultObject).toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 直播数据统计(场次)
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ * @throws P2Exception
|
|
|
+ */
|
|
|
+ public String getLiveDataCountForSession() throws P2Exception {
|
|
|
+ String sessionid = content.getString("sessionid");
|
|
|
+ double livepv = 0;
|
|
|
+ double liveuv = 0;
|
|
|
+ double duration = 0;
|
|
|
+ PaoSetRemote paoSetRemote = getP2ServerSystemPaoSet("tlive_sessiondata", "sessionid = '" + sessionid + "'");
|
|
|
+ if (!paoSetRemote.isEmpty()) {
|
|
|
+ PaoRemote paoRemote = paoSetRemote.getPao(0);
|
|
|
+ //人数
|
|
|
+ livepv = paoRemote.getDouble("livepv");
|
|
|
+ //人次
|
|
|
+ liveuv = paoRemote.getDouble("liveuv");
|
|
|
+ //时长
|
|
|
+ duration = paoRemote.getDouble("duration");
|
|
|
+ }
|
|
|
+
|
|
|
+ JSONObject resultObject = new JSONObject();
|
|
|
+
|
|
|
+ resultObject.put("livepv", String.format("%.2f", livepv));
|
|
|
+ resultObject.put("liveuv", String.format("%.2f", liveuv));
|
|
|
+ resultObject.put("duration", String.format("%.2f", duration));
|
|
|
+ resultObject.put("liveuvAvg", String.format("%.2f", livepv == 0 ? 0 : liveuv / livepv));
|
|
|
+ resultObject.put("durationAvg", String.format("%.2f", livepv == 0 ? 0 : duration / livepv));
|
|
|
+
|
|
|
+ return getSucReturnObject().setData(resultObject).toString();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 直播用户观看列表
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public String getLiveUserList() {
|
|
|
+ String channelid = content.getString("channelid");
|
|
|
+ String sessionid = content.getString("sessionid");
|
|
|
+
|
|
|
+ SQLFactory sqlFactory = new SQLFactory(this, "直播用户观看列表");
|
|
|
+ sqlFactory.addParameter("channelid", channelid);
|
|
|
+ sqlFactory.addParameter("sessionid", sessionid);
|
|
|
+ Rows rows = dbConnect.runSqlQuery(sqlFactory.getSQL());
|
|
|
+
|
|
|
+ return getSucReturnObject().setData(rows).toString();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 直播场次列表查询
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public String getLiveSessionList() {
|
|
|
+
|
|
|
+ String channelid = content.getString("channelid");
|
|
|
+ SQLFactory sqlFactory = new SQLFactory(this, "直播场次列表查询", pageSize, pageNumber, "createdate");
|
|
|
+ sqlFactory.addParameter("channelid", channelid);
|
|
|
+ Rows rows = dbConnect.runSqlQuery(sqlFactory.getSQL());
|
|
|
+ return getSucReturnObject().setDataByPaging(rows).preloading(1).toString();
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 私域直播详情
|
|
|
@@ -132,6 +222,7 @@ public class live extends Controller {
|
|
|
//观看人数(人)
|
|
|
double viewers = getCount("观看人数", "num", channelid);
|
|
|
resultObject.put("viewers", String.format("%.2f", viewers));
|
|
|
+ System.err.println(viewCounts+","+viewDuration+","+viewers);
|
|
|
//人均观看次数(次)
|
|
|
resultObject.put("viewCountsAvg", String.format("%.2f", viewers == 0.0 ? 0 : viewCounts / viewers));
|
|
|
//人均观看时长(分钟)
|
|
|
@@ -225,7 +316,7 @@ public class live extends Controller {
|
|
|
public String getSYLiveSessionList() {
|
|
|
|
|
|
String channelid = content.getString("channelid");
|
|
|
- SQLFactory sqlFactory = new SQLFactory(this, "直播场次列表查询", pageSize, pageNumber, "createdate");
|
|
|
+ SQLFactory sqlFactory = new SQLFactory(this, "私域直播场次列表查询", pageSize, pageNumber, "createdate");
|
|
|
sqlFactory.addParameter("channelid", channelid);
|
|
|
Rows rows = dbConnect.runSqlQuery(sqlFactory.getSQL());
|
|
|
return getSucReturnObject().setDataByPaging(rows).preloading(1).toString();
|
|
|
@@ -241,9 +332,8 @@ public class live extends Controller {
|
|
|
*/
|
|
|
public double getCount(String SQLMODELNAME, String fieldname, String channelid) {
|
|
|
SQLFactory sqlFactory = new SQLFactory(this, SQLMODELNAME);
|
|
|
- sqlFactory.addParameter("siteid", siteid);
|
|
|
- sqlFactory.addParameter("tagentsid", tagentsid);
|
|
|
sqlFactory.addParameter("channelid", channelid);
|
|
|
+ System.err.println(sqlFactory.getSQL());
|
|
|
Rows rows = sqlFactory.runSqlQuery();
|
|
|
return rows.isEmpty() ? 0 : rows.get(0).getDouble(fieldname);
|
|
|
}
|