|
|
@@ -13,6 +13,7 @@ import p2.pao.PaoRemote;
|
|
|
import p2.pao.PaoSetRemote;
|
|
|
import p2.util.P2Exception;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
|
|
|
public class live extends Controller {
|
|
|
@@ -156,13 +157,13 @@ public class live extends Controller {
|
|
|
//人次
|
|
|
liveuv = paoRemote.getInt("liveuv");
|
|
|
//时长
|
|
|
- duration = paoRemote.getInt("duration")/60;
|
|
|
+ duration = paoRemote.getInt("duration") / 60;
|
|
|
}
|
|
|
|
|
|
JSONObject resultObject = new JSONObject();
|
|
|
|
|
|
- resultObject.put("viewers", livepv);
|
|
|
- resultObject.put("viewCounts", liveuv);
|
|
|
+ resultObject.put("viewers", livepv);
|
|
|
+ resultObject.put("viewCounts", liveuv);
|
|
|
resultObject.put("viewDuration", duration);
|
|
|
resultObject.put("viewCountsAvg", livepv == 0 ? 0 : liveuv / livepv);
|
|
|
resultObject.put("viewDurationAvg", livepv == 0 ? 0 : duration / livepv);
|
|
|
@@ -271,13 +272,13 @@ public class live extends Controller {
|
|
|
//人次
|
|
|
liveuv = paoRemote.getInt("liveuv");
|
|
|
//时长
|
|
|
- duration = paoRemote.getInt("duration")/60;
|
|
|
+ duration = paoRemote.getInt("duration") / 60;
|
|
|
}
|
|
|
|
|
|
JSONObject resultObject = new JSONObject();
|
|
|
|
|
|
resultObject.put("viewers", livepv);
|
|
|
- resultObject.put("viewCounts", liveuv);
|
|
|
+ resultObject.put("viewCounts", liveuv);
|
|
|
resultObject.put("viewDuration", duration);
|
|
|
resultObject.put("viewCountsAvg", livepv == 0 ? 0 : liveuv / livepv);
|
|
|
resultObject.put("viewDurationAvg", livepv == 0 ? 0 : duration / livepv);
|
|
|
@@ -354,4 +355,73 @@ public class live extends Controller {
|
|
|
Rows rows = sqlFactory.runSqlQuery();
|
|
|
return rows.isEmpty() ? 0 : rows.get(0).getLong(fieldname);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取实时直播观看人数
|
|
|
+ */
|
|
|
+ public String getRealTimeViewers() {
|
|
|
+ String channelid = content.getString("channelid");
|
|
|
+ String sql = "SELECT [count] FROM tlive_usercount WHERE [time]='" + getDateTime_Str() + "' AND channelid='" + channelid + "'";
|
|
|
+ Rows rows = dbConnect.runSqlQuery(sql);
|
|
|
+ JSONObject resultObject = new JSONObject();
|
|
|
+ resultObject.put("count", rows.isEmpty() ? 0 : rows.get(0).getLong("count"));
|
|
|
+ return getSucReturnObject().setData(resultObject).toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取实时观众列表
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public String getRealTimeViewerList() {
|
|
|
+ String channelid = content.getString("channelid");
|
|
|
+ Long createdtime = getDateTime().getTime() / 1000;
|
|
|
+ SQLFactory sqlFactory = new SQLFactory(this, "实时观众列表", pageSize, pageNumber, "t1.tlive_viewlogid DESC");
|
|
|
+ sqlFactory.addParameter("channelid", channelid);
|
|
|
+ sqlFactory.addParameter("createdtime", createdtime * 1000);
|
|
|
+ System.err.println(sqlFactory.getSQL());
|
|
|
+ Rows rows = dbConnect.runSqlQuery(sqlFactory.getSQL());
|
|
|
+ return getSucReturnObject().setDataByPaging(rows).preloading(1).toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取实时直播聊天列表
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public String getRealTimeMessageList() {
|
|
|
+ String channelid = content.getString("channelid");
|
|
|
+ Long time = getDateTime().getTime();
|
|
|
+ SQLFactory sqlFactory = new SQLFactory(this, "实时聊天列表", pageSize, pageNumber, "t1.tlive_usermessagid DESC");
|
|
|
+ sqlFactory.addParameter("channelid", channelid);
|
|
|
+ sqlFactory.addParameter("time", time);
|
|
|
+ System.err.println(sqlFactory.getSQL());
|
|
|
+ Rows rows = dbConnect.runSqlQuery(sqlFactory.getSQL());
|
|
|
+ return getSucReturnObject().setDataByPaging(rows).preloading(1).toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取合作商直播列表(包括私域、展会)
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public String getCooperationAgentsLiveList() {
|
|
|
+
|
|
|
+ //查询合作的商户id
|
|
|
+ String sql = "SELECT tcooperationagentsid FROM tagents_cooperation WHERE tagentsid = '" + tagentsid + "' AND fstatus = '合作';";
|
|
|
+ Rows rows = dbConnect.runSqlQuery(sql);
|
|
|
+ ArrayList<String> tagentsidList = new ArrayList<>();
|
|
|
+ for (Row row : rows) {
|
|
|
+ tagentsidList.add(row.getString("tcooperationagentsid"));
|
|
|
+ }
|
|
|
+ SQLFactory sqlFactory = new SQLFactory(this, "合作商直播列表");
|
|
|
+ sqlFactory.addParameter("siteid", siteid);
|
|
|
+ sqlFactory.addParameter_in("tagentsidList", tagentsidList);
|
|
|
+ System.err.println(sqlFactory.getSQL());
|
|
|
+ Rows agentRows = dbConnect.runSqlQuery(sqlFactory.getSQL());
|
|
|
+
|
|
|
+ return getSucReturnObject().setData(agentRows).toString();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|