* @description 刷新定时任务
()
| 4293 | * @description 刷新定时任务 |
| 4294 | */ |
| 4295 | async function refreshScheduleTask() { |
| 4296 | // 清除定时刷新 |
| 4297 | clearInterval(scheduleTimer); |
| 4298 | // 未登录 |
| 4299 | if (!login.value) { |
| 4300 | // 剩余定时任务 |
| 4301 | const restList = scheduleList.filter((s) => !isLate(s)); |
| 4302 | // 存在剩余任务 |
| 4303 | if (restList.length) { |
| 4304 | const rest = restList[0]; |
| 4305 | log(`已设置 ${rest.time} 的定时任务!`); |
| 4306 | // 提示 |
| 4307 | createTip(`已设置 ${rest.time} 的定时任务!`); |
| 4308 | // 时间 |
| 4309 | let time = 0; |
| 4310 | // 刷新间隔 |
| 4311 | const interval = 10; |
| 4312 | scheduleTimer = setInterval(() => { |
| 4313 | if (!(time++ % interval)) { |
| 4314 | log('定时刷新正在运行...'); |
| 4315 | } |
| 4316 | // 到达定时 |
| 4317 | if (isNow(rest)) { |
| 4318 | clearInterval(scheduleTimer); |
| 4319 | log(`执行 ${rest.time} 的定时任务!`); |
| 4320 | // 提示 |
| 4321 | createTip(`执行 ${rest.time} 的定时任务!`); |
| 4322 | // 登录 |
| 4323 | handleLogin(); |
| 4324 | } |
| 4325 | }, 1000); |
| 4326 | } |
| 4327 | } |
| 4328 | } |
| 4329 | /** |
| 4330 | * @description 清除定时 |
| 4331 | */ |
no test coverage detected