缓存修改

master
yin5th 2021-11-24 14:37:59 +08:00
parent 4a62e87cc6
commit ec5551f70e
1 changed files with 5 additions and 5 deletions

View File

@ -48,15 +48,15 @@ function getFirstEventKeyword(name) {
// 设置领舞 name=姓名 time=有效期 单位秒
function setLeader(name, time) {
localStorage.setItem('leader', name)
localStorage.setItem('leader_end_at', (new Date).getTime()/1000 + time)
sessionStorage.setItem('leader', name)
sessionStorage.setItem('leader_end_at', (new Date).getTime()/1000 + time)
}
// 获取领舞人信息
function getLeader() {
let res = []
res['name'] = localStorage.getItem('leader') ? localStorage.getItem('leader') : ''
res['time'] = localStorage.getItem('leader_end_at') ? localStorage.getItem('leader_end_at') : 0
res['name'] = sessionStorage.getItem('leader') ? sessionStorage.getItem('leader') : ''
res['time'] = sessionStorage.getItem('leader_end_at') ? sessionStorage.getItem('leader_end_at') : 0
return res
}
@ -158,7 +158,7 @@ function receiveMessage(event)
let random2 = Math.floor(Math.random() + 0.5)
// 获取领舞信息
let leaderInfo = localStorage.getItem('leader')
let leaderInfo = sessionStorage.getItem('leader')
let isLeader = data.uname == leaderInfo ? 1 : 0
// 给弹幕加上随机事件