()
| 380 | } |
| 381 | |
| 382 | async completeVideoDurationTasks() { |
| 383 | try { |
| 384 | let userInfo = await this.getUserInfo(); |
| 385 | let nextStep = Number(userInfo.okLookVideoSec || 0); |
| 386 | if (nextStep < 1) nextStep = 1; |
| 387 | if (nextStep > VIDEO_DURATION_STEPS.length) { |
| 388 | $.log(`账号[${this.index}] 看视频时长前置: 今日已完成`); |
| 389 | return; |
| 390 | } |
| 391 | |
| 392 | for (let step = nextStep; step <= VIDEO_DURATION_STEPS.length; step++) { |
| 393 | await this.updateUserWatchDuration(VIDEO_DURATION_STEPS[step - 1], step); |
| 394 | try { |
| 395 | const result = await this.request({ apiPath: "/app/integral/lookVideoSec" }); |
| 396 | $.log(`账号[${this.index}] 看视频时长金币[${step}/${VIDEO_DURATION_STEPS.length}]: ${result.msg || "success"}`); |
| 397 | userInfo = await this.getUserInfo(); |
| 398 | if (Number(userInfo.okLookVideoSec || 0) > VIDEO_DURATION_STEPS.length) break; |
| 399 | } catch (e) { |
| 400 | const message = String(e.message || e); |
| 401 | if (/已领取|已完成|今日.*完成|重复|不能重复|已经.*领取/.test(message)) { |
| 402 | $.log(`账号[${this.index}] 看视频时长金币: 今日已完成`); |
| 403 | break; |
| 404 | } |
| 405 | $.log(`账号[${this.index}] 看视频时长金币[${step}/${VIDEO_DURATION_STEPS.length}]: ${message}`); |
| 406 | if (e.code === 401 || /token|登录|验证失败/.test(message)) this.removeCachedToken(); |
| 407 | break; |
| 408 | } |
| 409 | } |
| 410 | } catch (e) { |
| 411 | $.log(`账号[${this.index}] 看视频时长前置失败: ${e.message || e}`); |
| 412 | } |
| 413 | } |
| 414 | |
| 415 | async updateUserWatchDuration(videoSec, lookVideoSec) { |
| 416 | const userInfo = await this.getUserInfo(); |
no test coverage detected