From de4c47f45ab245cc89121dac1401a4fcdd29bde8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9F=8C=8C?= Date: Thu, 6 Jun 2024 00:28:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20=E7=BC=93=E5=AD=98?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/genshin/model/mys/mysInfo.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/plugins/genshin/model/mys/mysInfo.js b/plugins/genshin/model/mys/mysInfo.js index e3bb190..b41f3b0 100644 --- a/plugins/genshin/model/mys/mysInfo.js +++ b/plugins/genshin/model/mys/mysInfo.js @@ -259,24 +259,22 @@ export default class MysInfo { */ static async initCache (force = false, clearData = false) { // 检查缓存标记 - let cache = DailyCache.create() - if (!force && await cache.get('cache-ready')) { + const cache = DailyCache.create() + if (!force && await cache.get('cache-ready') || this.initing) return true - } + this.initing = true await DailyCache.clearOutdatedData() - if (clearData) { + if (clearData) await MysUser.clearCache() - } // 先初始化用户CK,减少一些公共CK中ltuid无法识别的情况 await MysInfo.initUserCk() - - await cache.set('cache-ready', new Date() * 1) - // 初始化公共ck await MysInfo.initPubCk() + await cache.set('cache-ready', new Date() * 1) + delete this.initing return true } @@ -462,4 +460,4 @@ export default class MysInfo { /** 统计次数设为超限 */ await this.ckUser.disable(game) } -} +} \ No newline at end of file