|
|
@@ -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);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 热门展商
|