Kaynağa Gözat

活动商户排序、直播观看人数错误修复

沈静伟 3 yıl önce
ebeveyn
işleme
8d57ea9da5

+ 5 - 6
src/dsb/com/cnd3b/restcontroller/customer/live/live.java

@@ -360,10 +360,11 @@ public class live extends Controller {
      */
     public String getRealTimeViewers() {
         String channelid = content.getString("channelid");
-        String sql = "SELECT [count] FROM tlive_usercount WHERE [time]='" + getDateTime_Str() + "' AND channelid='" + channelid + "'";
+        //String sql = "SELECT [count] FROM tlive_usercount WHERE [time]='" + getDateTime_Str() + "' AND channelid='" + channelid + "'";
+        String sql = "select channelid,count as fcustcount from (select ROW_NUMBER()over(partition by t1.channelid order by t1.time desc)as num,t1.channelid,t1.count from tlive_usercount t1 where t1. channelid='" + channelid + "')t where t.num=1";
         Rows rows = dbConnect.runSqlQuery(sql);
         JSONObject resultObject = new JSONObject();
-        resultObject.put("count", rows.isEmpty() ? 0 : rows.get(0).getLong("count"));
+        resultObject.put("count", rows.isEmpty() ? 0 : rows.get(0).getLong("fcustcount"));
         return getSucReturnObject().setData(resultObject).toString();
     }
 
@@ -374,7 +375,7 @@ public class live extends Controller {
      */
     public String getRealTimeViewerList() {
         String channelid = content.getString("channelid");
-        Long lastmodified = getDateTime().getTime() / 1000- 5* 60;
+        Long lastmodified = getDateTime().getTime() / 1000 - 5 * 60;
         System.err.println(lastmodified);
         SQLFactory sqlFactory = new SQLFactory(this, "实时观众列表", pageSize, pageNumber, "t1.tlive_viewlogid DESC");
         sqlFactory.addParameter("channelid", channelid);
@@ -417,7 +418,7 @@ public class live extends Controller {
         sqlFactory.addParameter_in("tagentsidList", tagentsidList);
         Rows agentRows = dbConnect.runSqlQuery(sqlFactory.getSQL());
 
-        for(Row row:agentRows){
+        for (Row row : agentRows) {
             //观看次数(次)
             String channelid = row.getString("channelid");
             //观看人数(人)
@@ -426,8 +427,6 @@ public class live extends Controller {
         }
 
 
-
-
         return getSucReturnObject().setData(agentRows).toString();
     }
 

+ 2 - 2
src/dsb/com/cnd3b/restcontroller/enterprise/activity/activity.java

@@ -106,8 +106,8 @@ public class activity extends Controller {
         /**
          *排序条件设置
          */
-        String[] sortfield = {"t1.tactivityid desc"};
-        String sort = getSort(sortfield, "t1.tactivityid desc");
+        String[] sortfield = {"t1.tactivity_agentmsgid desc"};
+        String sort = getSort(sortfield, "t1.tactivity_agentmsgid desc");
         /**
          * 过滤条件设置
          */