From 41ce7b08c4492b3085faf9b91cc90eb101a981e0 Mon Sep 17 00:00:00 2001 From: Ctrlcvs <1509167646@qq.com> Date: Thu, 1 Sep 2022 09:55:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E7=BC=93=E5=AD=98=E6=9C=BA?= =?UTF-8?q?=E5=88=B6=EF=BC=8C=E9=81=BF=E5=85=8D=E9=87=8D=E5=A4=8D=E8=AF=B7?= =?UTF-8?q?=E6=B1=82=E5=AF=BC=E8=87=B4=E5=88=B7=E5=B1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/user.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/apps/user.js b/apps/user.js index 585c7da..4575bea 100644 --- a/apps/user.js +++ b/apps/user.js @@ -66,6 +66,12 @@ export async function gclog(e) { e.reply("请先绑定stoken") return true; } + let redis_Data = await redis.get(`xiaoyao:gclog:${e.user_id}`); + if(redis_Data){ + let time=redis_Data*1-Math.floor(Date.now()/1000); + e.reply(`请求过快,请${time}秒后重试...`); + return true; + } let miHoYoApi = new MihoYoApi(e); let kkbody = await miHoYoApi.getbody("原神"); const objData = await miHoYoApi.getUserInfo(kkbody) @@ -110,5 +116,8 @@ export async function gclog(e) { e.isPrivate = true; await bing(e) } + redis.set(`xiaoyao:gclog:${e.user_id}`, Math.floor(Date.now()/1000)+(60*5), { //把色图链接写入缓存防止一直色色 + EX: 60*5 + }); return true; }