|
|
@@ -314,6 +314,15 @@ public class homepage extends Controller {
|
|
|
sqlFactory_tlive.addParameter("siteid", siteid);
|
|
|
sqlFactory_tlive.addParameter("keyStr", "%" + keyStr + "%");
|
|
|
Rows row_tlive = dbConnect.runSqlQuery(sqlFactory_tlive.getSQL());
|
|
|
+
|
|
|
+ for(Row row:row_tlive){
|
|
|
+ //观看次数(次)
|
|
|
+ String channelid = row.getString("channelid");
|
|
|
+ //观看人数(人)
|
|
|
+ long viewers = getCount("直播观看人数", "num", channelid);
|
|
|
+ row.put("viewers", viewers);
|
|
|
+ }
|
|
|
+
|
|
|
resultObject.put("tlive", row_tlive);
|
|
|
} else {
|
|
|
resultObject.put("tlive", new Rows());
|
|
|
@@ -359,4 +368,12 @@ public class homepage extends Controller {
|
|
|
return getSucReturnObject().setData(resultObject).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);
|
|
|
+ }
|
|
|
+
|
|
|
}
|