|
|
@@ -8,6 +8,7 @@ import com.cnd3b.common.data.Rows;
|
|
|
import com.cnd3b.common.data.SQLFactory;
|
|
|
import com.cnd3b.common.data.db.DataPool;
|
|
|
import com.cnd3b.utility.polyv.Polyv;
|
|
|
+import p2.common.parse.A;
|
|
|
import p2.pao.PaoRemote;
|
|
|
import p2.pao.PaoSetRemote;
|
|
|
import p2.util.P2Exception;
|
|
|
@@ -98,6 +99,7 @@ public class live extends Controller {
|
|
|
public String getSYLiveInfo() throws P2Exception {
|
|
|
SQLFactory sqlFactory = new SQLFactory(this, "私域直播详情");
|
|
|
sqlFactory.addParameter("siteid", siteid);
|
|
|
+ sqlFactory.addParameter("tagentsid", tagentsid);
|
|
|
Rows rows = dbConnect.runSqlQuery(sqlFactory.getSQL());
|
|
|
if (rows.isEmpty()) {
|
|
|
PaoSetRemote paoSetRemote = getP2ServerSystemPaoSet("tliveapply", "siteid = '" + siteid + "' AND fissecret = 1 AND fstatus = '申请'");
|
|
|
@@ -114,26 +116,61 @@ public class live extends Controller {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 私域直播数据统计
|
|
|
+ * 私域直播数据统计(频道)
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
public String getSYLiveDataCount() {
|
|
|
-
|
|
|
+ String channelid = content.getString("channelid");
|
|
|
JSONObject resultObject = new JSONObject();
|
|
|
//观看次数(次)
|
|
|
- double viewCounts = getCount("观看次数", "num");
|
|
|
+ double viewCounts = getCount("观看次数", "num", channelid);
|
|
|
resultObject.put("viewCounts", String.format("%.2f", viewCounts));
|
|
|
//观看时长(分钟)
|
|
|
- double viewDuration = getCount("观看时长", "num");
|
|
|
+ double viewDuration = getCount("观看时长", "num", channelid);
|
|
|
resultObject.put("viewDuration", String.format("%.2f", viewDuration));
|
|
|
//观看人数(人)
|
|
|
- double viewers = getCount("观看人数", "num");
|
|
|
+ double viewers = getCount("观看人数", "num", channelid);
|
|
|
resultObject.put("viewers", String.format("%.2f", viewers));
|
|
|
+ System.err.println(viewers);
|
|
|
//人均观看次数(次)
|
|
|
- resultObject.put("viewCountsAvg", String.format("%.2f", viewCounts / viewers));
|
|
|
+ resultObject.put("viewCountsAvg", String.format("%.2f", viewers == 0.0 ? 0 : viewCounts / viewers));
|
|
|
//人均观看时长(分钟)
|
|
|
- resultObject.put("viewDurationAvg", String.format("%.2f", viewDuration / viewers));
|
|
|
+ resultObject.put("viewDurationAvg", String.format("%.2f", viewers == 0.0 ? 0 : viewDuration / viewers));
|
|
|
+
|
|
|
+ return getSucReturnObject().setData(resultObject).toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 私域直播数据统计(场次)
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ * @throws P2Exception
|
|
|
+ */
|
|
|
+ public String getSYLiveDataCountForSession() 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();
|
|
|
}
|
|
|
@@ -145,8 +182,12 @@ public class live extends Controller {
|
|
|
* @return
|
|
|
*/
|
|
|
public String getSYLiveUserList() {
|
|
|
+ String channelid = content.getString("channelid");
|
|
|
+ String sessionid = content.getString("sessionid");
|
|
|
+
|
|
|
SQLFactory sqlFactory = new SQLFactory(this, "私域直播用户观看列表");
|
|
|
- sqlFactory.addParameter_SQL("siteid", siteid);
|
|
|
+ sqlFactory.addParameter("channelid", channelid);
|
|
|
+ sqlFactory.addParameter("sessionid", sessionid);
|
|
|
Rows rows = dbConnect.runSqlQuery(sqlFactory.getSQL());
|
|
|
|
|
|
return getSucReturnObject().setData(rows).toString();
|
|
|
@@ -176,7 +217,22 @@ public class live extends Controller {
|
|
|
return getErrReturnObject().setErrMsg("私域直播已申请").toString();
|
|
|
}
|
|
|
|
|
|
+ }
|
|
|
|
|
|
+ /**
|
|
|
+ * 私域直播场次列表查询
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public String getSYLiveSessionList() {
|
|
|
+
|
|
|
+ String channelid = content.getString("channelid");
|
|
|
+ SQLFactory sqlFactory = new SQLFactory(this, "直播场次列表查询", pageSize, pageNumber, "createdate");
|
|
|
+ sqlFactory.addParameter("channelid", channelid);
|
|
|
+
|
|
|
+ System.err.println(sqlFactory.getSQL());
|
|
|
+ Rows rows = dbConnect.runSqlQuery(sqlFactory.getSQL());
|
|
|
+ return getSucReturnObject().setDataByPaging(rows).preloading(1).toString();
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -187,9 +243,11 @@ public class live extends Controller {
|
|
|
* @param fieldname 取数据的字段名称
|
|
|
* @return
|
|
|
*/
|
|
|
- public double getCount(String SQLMODELNAME, String fieldname) {
|
|
|
+ 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);
|
|
|
Rows rows = sqlFactory.runSqlQuery();
|
|
|
return rows.isEmpty() ? 0 : rows.get(0).getDouble(fieldname);
|
|
|
}
|