高能榜刷新优化

master
yin5th 2021-11-30 14:57:34 +08:00
parent b6464a4a7c
commit d22a0acf1b
1 changed files with 28 additions and 24 deletions

View File

@ -166,34 +166,38 @@ function receiveMessage(event)
return false
}
let leaderInfo = ''
console.log(highList, '获取的高能榜单')
// 高能榜列表
if (highList.length > 0) {
leaderInfo = highList[0]
// 获取当前领舞人
let currentLeader = getLeader()
let now = (new Date).getTime()/1000
if (currentLeader['name'] === '') {
setLeader(highList[0], leaderTime)
} else {
//领舞人存在 检查过期时间
if (currentLeader['time'] === 0 || currentLeader['time'] < now) {
// 切换领舞
// let currentLeader = getLeader()
// let now = (new Date).getTime()/1000
// if (currentLeader['name'] === '') {
// setLeader(highList[0], leaderTime)
// } else {
// //领舞人存在 检查过期时间
// if (currentLeader['time'] === 0 || currentLeader['time'] < now) {
// // 切换领舞
// 当前领舞人
let leaderIndex = highList.indexOf(currentLeader['name'])
let newLeader
if (leaderIndex == -1) {
newLeader = highList[0]
} else {
let newIndex = leaderIndex + 1
if (newIndex >= highList.length) {
newIndex = 0
}
newLeader = highList[newIndex]
}
// // 当前领舞人
// let leaderIndex = highList.indexOf(currentLeader['name'])
// let newLeader
// if (leaderIndex == -1) {
// newLeader = highList[0]
// } else {
// let newIndex = leaderIndex + 1
// if (newIndex >= highList.length) {
// newIndex = 0
// }
// newLeader = highList[newIndex]
// }
setLeader(newLeader, leaderTime)
}
}
// setLeader(newLeader, leaderTime)
// }
// }
}
// uid是否存在 不存在则存入uidObj
@ -213,7 +217,7 @@ function receiveMessage(event)
// custom.js中 每条弹幕的处理 放到了此处
// -------------------- 每条弹幕处理 begin -----------------------
// 获取领舞信息
let leaderInfo = sessionStorage.getItem('leader')
// let leaderInfo = sessionStorage.getItem('leader')
let eventName = getEvent(data.danmaku)
let isLeader = data.uname == leaderInfo ? 1 : 0