瀏覽代碼

保利威直播间状态获取错误修复

沈静伟 3 年之前
父節點
當前提交
fb1c1bdbf9
共有 1 個文件被更改,包括 14 次插入12 次删除
  1. 14 12
      src/dsb/com/cnd3b/service/GetPolyvAnalysisData.java

+ 14 - 12
src/dsb/com/cnd3b/service/GetPolyvAnalysisData.java

@@ -49,9 +49,9 @@ public class GetPolyvAnalysisData extends BaseClass implements Runnable {
         if (channelids.length > 20) {
             int size = channelids.length / 20;
             for (int i = 0; i < size; i++) {
-                livestatusMap.putAll(polyv.getLiveStatuses(Arrays.copyOfRange(channelids, i * 20, (i + 1) * 20 )));
+                livestatusMap.putAll(polyv.getLiveStatuses(Arrays.copyOfRange(channelids, i * 20, (i + 1) * 20)));
             }
-            livestatusMap.putAll(polyv.getLiveStatuses(Arrays.copyOfRange(channelids, size * 20, channelids.length )));
+            livestatusMap.putAll(polyv.getLiveStatuses(Arrays.copyOfRange(channelids, size * 20, channelids.length)));
         } else {
             livestatusMap = polyv.getLiveStatuses(channelids);
         }
@@ -59,17 +59,19 @@ public class GetPolyvAnalysisData extends BaseClass implements Runnable {
         ArrayList<String> sqllist = new ArrayList<>();
         for (String channelid : livestatusMap.keySet()) {
             String livestatus = livestatusMap.get(channelid);
-            if (livestatus.equalsIgnoreCase("live")) {
-                sqllist.add("update tlive set livestatus='" + livestatus + "',lastlivedate='" + getDate_Str() + "' ,channelcoverimageurl='" + polyv.getChannelImage(channelid, livestatus) + "' where channelid='" + channelid + "'");
-                if (!livestatus.equals(map.get(channelid).get(0).getString("livestatus"))) {
-                    long tagentsid = map.get(channelid).get(0).getLong("tagentsid");
-                    String siteid = map.get(channelid).get(0).getString("siteid");
-                    createLiveMessage(siteid, tagentsid);
+            if (map.containsKey(channelid)) {
+                if (livestatus.equalsIgnoreCase("live")) {
+                    sqllist.add("update tlive set livestatus='" + livestatus + "',lastlivedate='" + getDate_Str() + "' ,channelcoverimageurl='" + polyv.getChannelImage(channelid, livestatus) + "' where channelid='" + channelid + "'");
+                    if (!livestatus.equals(map.get(channelid).get(0).getString("livestatus"))) {
+                        long tagentsid = map.get(channelid).get(0).getLong("tagentsid");
+                        String siteid = map.get(channelid).get(0).getString("siteid");
+                        createLiveMessage(siteid, tagentsid);
+                    }
+                } else if (livestatus.equalsIgnoreCase("waiting")) {
+                    sqllist.add("update tlive set livestatus='" + livestatus + "',channelcoverimageurl='" + polyv.getChannelImage(channelid, livestatus) + "' where channelid='" + channelid + "'");
+                } else {
+                    sqllist.add("update tlive set livestatus='" + livestatus + "' where channelid='" + channelid + "'");
                 }
-            } else if (livestatus.equalsIgnoreCase("waiting")) {
-                sqllist.add("update tlive set livestatus='" + livestatus + "',channelcoverimageurl='" + polyv.getChannelImage(channelid, livestatus) + "' where channelid='" + channelid + "'");
-            } else {
-                sqllist.add("update tlive set livestatus='" + livestatus + "' where channelid='" + channelid + "'");
             }
         }
         dbConnect.runSqlUpdate(sqllist);