|
|
@@ -2,8 +2,11 @@ package com.cnd3b.restcontroller.publicmethod.live;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.cnd3b.common.Controller;
|
|
|
+import com.cnd3b.common.data.Row;
|
|
|
import com.cnd3b.common.data.Rows;
|
|
|
+import com.cnd3b.common.data.RowsMap;
|
|
|
import com.cnd3b.common.data.SQLFactory;
|
|
|
+import org.apache.ibatis.jdbc.SQL;
|
|
|
|
|
|
public class live extends Controller {
|
|
|
public live(JSONObject content) {
|
|
|
@@ -16,24 +19,65 @@ public class live extends Controller {
|
|
|
* @return
|
|
|
*/
|
|
|
public String getLiveChannelData() {
|
|
|
- Rows liveCountRows = dbConnect.runSqlQuery("select count(0)fcount from tlive where livestatus='live'");
|
|
|
- Rows liverows = dbConnect.runSqlQuery(new SQLFactory(this, "当前线上观众人数查询").getSQL());
|
|
|
- Rows totalcustCountrows = dbConnect.runSqlQuery("select count(0)fcount from tlive_viewlog");
|
|
|
-
|
|
|
+ String tactivityid = content.getString("tactivityid");
|
|
|
JSONObject resultObject = new JSONObject();
|
|
|
- //直播商户数
|
|
|
- resultObject.put("flivecount", liveCountRows.isEmpty() ? 0 : liveCountRows.get(0).getInteger("fcount"));
|
|
|
- //当前在线观众人数
|
|
|
- resultObject.put("fcustcount", liverows.isEmpty() ? 0 : liverows.sum("fcount"));
|
|
|
- //直播总时长
|
|
|
- resultObject.put("ftotallivetime", 1000);
|
|
|
+ //参展商
|
|
|
+ SQLFactory agentcountSql = new SQLFactory(this, "活动直播间总数查询");
|
|
|
+ agentcountSql.addParameter("tactivityid", tactivityid);
|
|
|
+ Rows agentCountRows = agentcountSql.runSqlQuery();
|
|
|
+ resultObject.put("fagentcount", agentCountRows.isEmpty() ? 0 : agentCountRows.get(0).getInteger("fcount"));
|
|
|
+
|
|
|
//观众总人数
|
|
|
+ SQLFactory custcountSql = new SQLFactory(this, "活动直播间观众总数查询");
|
|
|
+ custcountSql.addParameter("tactivityid", tactivityid);
|
|
|
+ Rows totalcustCountrows = custcountSql.runSqlQuery();
|
|
|
resultObject.put("ftotalcustcount", totalcustCountrows.isEmpty() ? 0 : totalcustCountrows.get(0).getInteger("fcount"));
|
|
|
- /**
|
|
|
- * 直播列表
|
|
|
- */
|
|
|
+
|
|
|
+ SQLFactory livecustcount = new SQLFactory(this, "当前线上观众人数查询");
|
|
|
+ livecustcount.addParameter("tactivityid", tactivityid);
|
|
|
+ Rows liverows = dbConnect.runSqlQuery(livecustcount.getSQL());
|
|
|
+ //正在直播数
|
|
|
+ resultObject.put("flivecount", liverows.size());
|
|
|
+ //当前在线观众人数
|
|
|
+ resultObject.put("fcustcount", liverows.isEmpty() ? 0 : liverows.sum("fcount"));
|
|
|
+ //直播列表
|
|
|
resultObject.put("tlivelist", liverows);
|
|
|
return getSucReturnObject().setData(resultObject).toString();
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 热门展商
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public String agentList() {
|
|
|
+ String tactivityid = content.getString("tactivityid");
|
|
|
+ SQLFactory agentlistSql = new SQLFactory(this, "热门展商");
|
|
|
+ agentlistSql.addParameter("tactivityid", tactivityid);
|
|
|
+ Rows rows = agentlistSql.runSqlQuery();
|
|
|
+ RowsMap map = getAttachmentUrl("tactivity_agentmsg", rows.toArrayList("tactivity_agentmsgid"));
|
|
|
+ for (Row row : rows) {
|
|
|
+ row.put("attinfos", map.get(row.getString("tactivity_agentmsgid")));
|
|
|
+ }
|
|
|
+ return getSucReturnObject().setData(rows).saveToDataPool(10).toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 热门展品
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public String prodList() {
|
|
|
+ String tactivityid = content.getString("tactivityid");
|
|
|
+ SQLFactory agentlistSql = new SQLFactory(this, "热门展品");
|
|
|
+ agentlistSql.addParameter("tactivityid", tactivityid);
|
|
|
+ Rows rows = agentlistSql.runSqlQuery();
|
|
|
+ RowsMap map = getAttachmentUrl("tactivity_agentmsg", rows.toArrayList("tactivity_agentmsgid"));
|
|
|
+ for (Row row : rows) {
|
|
|
+ row.put("attinfos", map.get(row.getString("tactivity_agentmsgid")));
|
|
|
+ }
|
|
|
+ return getSucReturnObject().setData(rows).saveToDataPool(10).toString();
|
|
|
+ }
|
|
|
+
|
|
|
}
|