From f74c8a87765581547251761293666c43c9324dc6 Mon Sep 17 00:00:00 2001 From: luyuan <1162963624@qq.com> Date: Wed, 16 Sep 2020 19:01:33 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=8D=81=E7=A7=92=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E4=B8=80=E6=AC=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/http.api.js | 7 ++++++- pages/release/zhibo.nvue | 24 +++++++++++++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/common/http.api.js b/common/http.api.js index 79a9ca2..dc84906 100644 --- a/common/http.api.js +++ b/common/http.api.js @@ -157,7 +157,12 @@ const install = (Vue, vm) => { // 达人登录 starLogin({member_mobile,sms_code}) { return vm.$u.post("/Login/platformExpertPhoneLogin",{member_mobile,sms_code}) - } + }, + //上传直播间人数 + //https://mall.dmygkeji.com/storeapi/Streaming/changeLiveRealtimeNumber?live_id=1&realtime_number=10 + changeLiveRealtimeNumber({id,number}){ + return vm.$u.post("Streaming/changeLiveRealtimeNumber",{live_id:id,realtime_number:number}) + } } // 将各个定义的接口名称,统一放进对象挂载到vm.$u.api(因为vm就是this,也即this.$u.api)下 diff --git a/pages/release/zhibo.nvue b/pages/release/zhibo.nvue index e432831..049d477 100644 --- a/pages/release/zhibo.nvue +++ b/pages/release/zhibo.nvue @@ -374,7 +374,8 @@ danmulist:[], zhibo:true, jieshu:{}, - renshumax:0 + renshumax:0, + changeLiveRealtimeNumber:{} }, onLaunch: function() { console.log('App Launch'); @@ -394,6 +395,7 @@ // this.chatRoomService.sendMessages(this.room.id, message); }, onHide: function() { + clearInterval(this.changeLiveRealtimeNumber) console.log('App Hide'); }, //模拟onshow生命周期 @@ -444,6 +446,7 @@ return true; }, onLoad(a){ + console.log(getApp().globalData.im) uni.setKeepScreenOn({ keepScreenOn: true @@ -454,6 +457,7 @@ console.log('Bearer' + " " + token) this.chatroom_id = a.id this.live_id = a.live_id + uni.request({ url:"https://mall.dmygkeji.com/storeapi/Streaming/liveStreamList", method:"POST", @@ -527,6 +531,24 @@ } that.time = shi + ":" + fen + ":" + miao }, 1000); + setInterval(()=>{ + console.log("定时") + uni.request({ + url:"https://mall.dmygkeji.com/storeapi/Streaming/changeLiveRealtimeNumber", + method:"POST", + header:{ + 'Authorization' : 'Bearer' + " " + token + }, + data:{ + live_id:that.live_id, + realtime_number: that.room.onlineUsers.users.length - 1 < 0 ? 0 : that.room.onlineUsers.users.length - 1 + }, + success(res){ + console.log(JSON.stringify(res)) + } + }) + }, + 10 * 1000) // var roomToken = JSON.parse(options.roomToken); From a4fee4682f7d30e28a5d0c4c2e356f02e66feac5 Mon Sep 17 00:00:00 2001 From: luyuan <1162963624@qq.com> Date: Wed, 16 Sep 2020 19:05:13 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=88=A0=E9=99=A4=E4=BA=86=E6=B8=85?= =?UTF-8?q?=E6=A5=9A=E5=AE=9A=E6=97=B6=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/release/zhibo.nvue | 1 - 1 file changed, 1 deletion(-) diff --git a/pages/release/zhibo.nvue b/pages/release/zhibo.nvue index 049d477..967b401 100644 --- a/pages/release/zhibo.nvue +++ b/pages/release/zhibo.nvue @@ -395,7 +395,6 @@ // this.chatRoomService.sendMessages(this.room.id, message); }, onHide: function() { - clearInterval(this.changeLiveRealtimeNumber) console.log('App Hide'); }, //模拟onshow生命周期