浏览代码

直播间详情查询时,获取新的直播间密码

沈静伟 3 年之前
父节点
当前提交
d43ef26318

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

@@ -84,15 +84,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);

+ 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);