mirror of
https://github.com/yoimiya-kokomi/miao-plugin.git
synced 2024-11-25 17:35:34 +00:00
19 lines
433 B
JavaScript
19 lines
433 B
JavaScript
const AvatarUtil = {
|
|
needRefresh (time, force = 0, forceMap = {}) {
|
|
if (!time || force === 2) {
|
|
return true
|
|
}
|
|
if (force === true) {
|
|
force = 0
|
|
}
|
|
let duration = (new Date() * 1 - time * 1) / 1000
|
|
if (isNaN(duration) || duration < 0) {
|
|
return true
|
|
}
|
|
let reqTime = forceMap[force] === 0 ? 0 : (forceMap[force] || 60)
|
|
return duration > reqTime * 60
|
|
}
|
|
}
|
|
|
|
export default AvatarUtil
|