فهرست منبع

Merge remote-tracking branch 'origin/develop' into develop

沈静伟 3 سال پیش
والد
کامیت
baa18ca0a1

+ 2 - 0
src/dsb/com/cnd3b/restcontroller/publicmethod/live/SQL/直播观看人数.sql

@@ -0,0 +1,2 @@
+--Ö±²¥¼ä¹Û¿´×ÜÈËÊý
+select count(distinct param1)as num from tlive_viewlog where channelid=$channelid$

+ 30 - 0
src/dsb/com/cnd3b/restcontroller/publicmethod/live/SQL/门户直播列表.sql

@@ -0,0 +1,30 @@
+select t1.tliveid,
+       t1.siteid,
+       t1.createby,
+       t1.changeby,
+       t1.createdate,
+       t1.changedate,
+       t1.tactivityid,
+       t1.tliveapplyid,
+       t1.tagentsid,
+       t1.fliveurl_web,
+       t1.fliveurl_client,
+       t1.fliveshowurl,
+       t1.categoryid,
+       t1.categoryname,
+       t1.channelname,
+       t1.channelpasswd,
+       t1.channelid,
+       t1.fassistanturl,
+       t1.fisneedauth,
+       t1.secretkey,
+       t1.livestatus,
+       t1.channelcoverimageurl,
+       t2.fagentname
+from tlive t1
+         inner join tagents t2 on t1.siteid = t2.siteid and t1.tagentsid = t2.tagentsid
+where t1.siteid = $siteid$
+  and t1.livestatus like $livestatus$
+
+
+

+ 34 - 0
src/dsb/com/cnd3b/restcontroller/publicmethod/live/live.java

@@ -7,6 +7,8 @@ import com.cnd3b.common.data.Rows;
 import com.cnd3b.common.data.RowsMap;
 import com.cnd3b.common.data.SQLFactory;
 
+
+
 public class live extends Controller {
     public live(JSONObject content) {
         super(content);
@@ -78,6 +80,38 @@ public class live extends Controller {
         return getSucReturnObject().setData(resultObject).toString();
     }
 
+    /**
+     * 通过直播状态获取门户直播列表
+     * @return
+     */
+    public String getHomeLive(){
+        //直播状态 unStart:未开始 live:直播中 end:已结束 waiting:等待中 playback:回放中
+        String livestatus = content.getString("livestatus");
+        SQLFactory sqlFactory = new SQLFactory(this, "门户直播列表",pageSize,pageNumber,"t1.createdate");
+        sqlFactory.addParameter("siteid", siteid);
+        sqlFactory.addParameter("livestatus", "%" + livestatus + "%");
+        System.err.println(sqlFactory.getSQL());
+        Rows agentRows = dbConnect.runSqlQuery(sqlFactory.getSQL());
+        for(Row row:agentRows){
+            //观看次数(次)
+            String channelid = row.getString("channelid");
+            //观看人数(人)
+            long viewers = getCount("直播观看人数", "num", channelid);
+            row.put("viewers", viewers);
+        }
+
+        return getSucReturnObject().setDataByPaging(agentRows).preloading(1).toString();
+
+
+    }
+
+    public long getCount(String SQLMODELNAME, String fieldname, String channelid) {
+        SQLFactory sqlFactory = new SQLFactory(this, SQLMODELNAME);
+        sqlFactory.addParameter("channelid", channelid);
+        Rows rows = sqlFactory.runSqlQuery();
+        return rows.isEmpty() ? 0 : rows.get(0).getLong(fieldname);
+    }
+
 
     /**
      * 热门展商