From 7ab38101e2b52fb5a15665e3165e8943bf9d85b0 Mon Sep 17 00:00:00 2001 From: SmallK111407 <3399280843@qq.com> Date: Mon, 19 Aug 2024 23:29:58 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=20%=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E6=8A=BD=E5=8D=A1=E8=AE=B0=E5=BD=95=20=E7=9A=84=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E9=A1=BA=E5=BA=8F=EF=BC=8C=E9=98=B2=E6=AD=A2=E5=87=BA?= =?UTF-8?q?=E7=8E=B0=E6=9C=AA=E7=BB=91=E5=AE=9Acookie=E6=97=B6=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E6=9B=B4=E6=96=B0=E5=87=BA=E7=8E=B0=E7=9A=84=E6=97=A0?= =?UTF-8?q?=E6=95=88CD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/gachalog.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/gachalog.js b/apps/gachalog.js index 362410b..fc86323 100644 --- a/apps/gachalog.js +++ b/apps/gachalog.js @@ -135,17 +135,17 @@ export class GachaLog extends ZZZPlugin { const lastQueryTime = await redis.get(`ZZZ:GACHA:${uid}:LASTTIME`); const gachaConfig = settings.getConfig('gacha'); const coldTime = _.get(gachaConfig, 'interval', 300); - if (lastQueryTime && Date.now() - lastQueryTime < 1000 * coldTime) { - await this.reply(`${coldTime}秒内只能刷新一次,请稍后再试`); - return false; - } - await redis.set(`ZZZ:GACHA:${uid}:LASTTIME`, Date.now()); try { const key = await getAuthKey(this.e, this.User, uid); if (!key) { await this.reply('authKey获取失败,请检查cookie是否过期'); return false; } + if (lastQueryTime && Date.now() - lastQueryTime < 1000 * coldTime) { + await this.reply(`${coldTime}秒内只能刷新一次,请稍后再试`); + return false; + } + await redis.set(`ZZZ:GACHA:${uid}:LASTTIME`, Date.now()); this.getLog(key); } catch (error) { await this.reply(error.message);