miao-plugin/models/avatar/AvatarUtil.js

19 lines
433 B
JavaScript
Raw Permalink Normal View History

2023-10-19 09:48:52 +00:00
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