十秒提交一次

This commit is contained in:
2020-09-16 19:01:33 +08:00
parent 2f62fde4f6
commit f74c8a8776
2 changed files with 29 additions and 2 deletions

View File

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