sjw 3 年 前
コミット
c8ceae97a8

+ 14 - 0
src/dsb/com/cnd3b/restcontroller/customer/live/live.java

@@ -84,6 +84,20 @@ public class live extends Controller {
      */
     public String queryChannelMain() {
         long tliveid = content.getLong("tliveid");
+        try {
+            Rows channelidrows = dbConnect.runSqlQuery("select channelid from tlive where tliveid='" + tliveid + "'");
+            if (!channelidrows.isEmpty()) {
+                String channelid = channelidrows.get(0).getString("channelid");
+                Polyv polyv = new Polyv();
+                LiveChannelInfoResponse liveChannelInfoResponse = polyv.getChannelInfo(channelid);
+                if (liveChannelInfoResponse != null) {
+                    String channelpasswd = liveChannelInfoResponse.getChannelPasswd();
+                    dbConnect.runSqlUpdate("update tlive set channelpasswd='" + channelpasswd + "' where tliveid='" + tliveid + "'");
+                }
+            }
+        } catch ( Exception e) {
+            e.printStackTrace();
+        }
         Rows channelidrows = dbConnect.runSqlQuery("select channelid from tlive where tliveid='" + tliveid + "'");
         if (!channelidrows.isEmpty()) {
             String channelid = channelidrows.get(0).getString("channelid");

+ 6 - 6
src/dsb/com/cnd3b/restcontroller/enterprise/data/analysis.java

@@ -1,5 +1,6 @@
 package com.cnd3b.restcontroller.enterprise.data;
 
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.cnd3b.common.Controller;
 import com.cnd3b.common.data.Row;
@@ -24,10 +25,9 @@ public class analysis extends Controller {
      * @return
      */
     public String getOnLineUserList() {
-        Map<Long, ConcurrentHashMap<String, WebClientSocket>> websocketClients = parameter.websocketClients;
         ArrayList<String> userList = new ArrayList<>();
-        for (Map.Entry<Long, ConcurrentHashMap<String, WebClientSocket>> m : websocketClients.entrySet()) {
-            userList.add(String.valueOf(m.getKey()));
+        for (long userid : parameter.websocketClients.keySet()) {
+            userList.add(String.valueOf(userid));
         }
         SQLFactory sqlFactory = new SQLFactory(this, "在线用户实时", pageSize, pageNumber, "t1.tenterprise_userid");
         sqlFactory.addParameter_in("tenterprise_userid", userList);
@@ -45,14 +45,14 @@ public class analysis extends Controller {
      */
     public String getOnLineMerchantList() {
         ArrayList<String> userList = new ArrayList<>();
-        for (Map.Entry<Long, ConcurrentHashMap<String, WebClientSocket>> m : parameter.websocketClients.entrySet()) {
-            userList.add(String.valueOf(m.getKey()));
+        for (long userid : parameter.websocketClients.keySet()) {
+            userList.add(String.valueOf(userid));
         }
         SQLFactory sqlFactory = new SQLFactory(this, "在线商户实时", pageSize, pageNumber, "t1.tagentsid");
         sqlFactory.addParameter_in("tenterprise_userid", userList);
         Rows rows = dbConnect.runSqlQuery(sqlFactory.getSQL());
         for (Row row : rows) {
-            row.put("saleprodclass", JSONObject.parseObject(row.getString("saleprodclass")));
+            row.put("saleprodclass", JSONArray.parse(row.getString("saleprodclass")));
         }
         return getSucReturnObject().setDataByPaging(rows).preloading(1).toString();
     }

+ 12 - 8
src/dsb/com/cnd3b/restcontroller/enterprise/live/live.java

@@ -83,15 +83,19 @@ public class live extends Controller {
      */
     public String queryChannelMain() {
         long tliveid = content.getLong("tliveid");
-        Rows channelidrows = dbConnect.runSqlQuery("select channelid from tlive where tliveid='" + tliveid + "'");
-        if (!channelidrows.isEmpty()) {
-            String channelid = channelidrows.get(0).getString("channelid");
-            Polyv polyv = new Polyv();
-            LiveChannelInfoResponse liveChannelInfoResponse = polyv.getChannelInfo(channelid);
-            if (liveChannelInfoResponse != null) {
-                String channelpasswd = liveChannelInfoResponse.getChannelPasswd();
-                dbConnect.runSqlUpdate("update tlive set channelpasswd='" + channelpasswd + "' where tliveid='" + tliveid + "'");
+        try {
+            Rows channelidrows = dbConnect.runSqlQuery("select channelid from tlive where tliveid='" + tliveid + "'");
+            if (!channelidrows.isEmpty()) {
+                String channelid = channelidrows.get(0).getString("channelid");
+                Polyv polyv = new Polyv();
+                LiveChannelInfoResponse liveChannelInfoResponse = polyv.getChannelInfo(channelid);
+                if (liveChannelInfoResponse != null) {
+                    String channelpasswd = liveChannelInfoResponse.getChannelPasswd();
+                    dbConnect.runSqlUpdate("update tlive set channelpasswd='" + channelpasswd + "' where tliveid='" + tliveid + "'");
+                }
             }
+        } catch ( Exception e) {
+            e.printStackTrace();
         }
         SQLFactory sqlFactory = new SQLFactory(this, "Ö±²¥ÏêÇé²éѯ");
         sqlFactory.addParameter("siteid", siteid);

+ 12 - 13
src/dsb/com/cnd3b/utility/polyv/Polyv.java

@@ -97,19 +97,6 @@ public class Polyv extends BaseClass {
         return null;
     }
 
-    public LiveChannelInfoResponse getChannelInfo(String channelId) {
-        LiveChannelInfoRequest liveChannelRequest = new LiveChannelInfoRequest();
-        try {
-            liveChannelRequest.setChannelId(channelId);
-            LiveChannelInfoResponse liveChannelInfoResponse = new LiveChannelOperateServiceImpl().getChannelInfo(liveChannelRequest);
-            liveChannelInfoResponse.getChannelPasswd();
-            return liveChannelInfoResponse;
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-        return null;
-    }
-
     /**
      * 修改频道分类及名称
      *
@@ -214,6 +201,18 @@ public class Polyv extends BaseClass {
         return false;
     }
 
+    public LiveChannelInfoResponse getChannelInfo(String channelId) {
+        LiveChannelInfoRequest liveChannelRequest = new LiveChannelInfoRequest();
+        try {
+            liveChannelRequest.setChannelId(channelId);
+            LiveChannelInfoResponse liveChannelInfoResponse = new LiveChannelOperateServiceImpl().getChannelInfo(liveChannelRequest);
+            liveChannelInfoResponse.getChannelPasswd();
+            return liveChannelInfoResponse;
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
     /**
      * 频道封面map
      */