Browse Source

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

沈静伟 3 years ago
parent
commit
916b54b894

+ 13 - 2
src/dsb/com/cnd3b/restcontroller/customer/live/live.java

@@ -8,6 +8,7 @@ import com.cnd3b.common.data.Rows;
 import com.cnd3b.common.data.SQLFactory;
 import com.cnd3b.common.data.db.DataPool;
 import com.cnd3b.utility.polyv.Polyv;
+import net.polyv.live.v1.entity.channel.operate.LiveChannelInfoResponse;
 import p2.pao.PaoRemote;
 import p2.pao.PaoSetRemote;
 import p2.util.P2Exception;
@@ -83,6 +84,16 @@ 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 + "'");
+            }
+        }
         SQLFactory sqlFactory = new SQLFactory(this, "直播详情查询");
         sqlFactory.addParameter("siteid", siteid);
         sqlFactory.addParameter("tliveid", tliveid);
@@ -156,7 +167,7 @@ public class live extends Controller {
             //人次
             liveuv = paoRemote.getInt("liveuv");
             //时长
-            duration = paoRemote.getInt("duration") ;
+            duration = paoRemote.getInt("duration");
         }
 
         JSONObject resultObject = new JSONObject();
@@ -271,7 +282,7 @@ public class live extends Controller {
             //人次
             liveuv = paoRemote.getInt("liveuv");
             //时长
-            duration = paoRemote.getInt("duration") ;
+            duration = paoRemote.getInt("duration");
         }
 
         JSONObject resultObject = new JSONObject();

+ 11 - 0
src/dsb/com/cnd3b/restcontroller/enterprise/live/live.java

@@ -7,6 +7,7 @@ import com.cnd3b.common.data.Rows;
 import com.cnd3b.common.data.SQLFactory;
 import com.cnd3b.common.data.db.DataPool;
 import com.cnd3b.utility.polyv.Polyv;
+import net.polyv.live.v1.entity.channel.operate.LiveChannelInfoResponse;
 import net.polyv.live.v1.entity.channel.operate.LiveChannelResponse;
 import p2.pao.PaoRemote;
 import p2.pao.PaoSetRemote;
@@ -82,6 +83,16 @@ 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 + "'");
+            }
+        }
         SQLFactory sqlFactory = new SQLFactory(this, "Ö±²¥ÏêÇé²éѯ");
         sqlFactory.addParameter("siteid", siteid);
         sqlFactory.addParameter("tliveid", tliveid);

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

@@ -97,6 +97,19 @@ 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;
+    }
+
     /**
      * ÐÞ¸ÄÆµµÀ·ÖÀ༰Ãû³Æ
      *