mirror of
https://github.com/ZZZure/ZZZ-Plugin.git
synced 2025-12-16 13:17:32 +00:00
Merge pull request #56 from SmallK111407/main
调整 %更新抽卡记录 的判断顺序,防止出现未绑定cookie时进行更新出现的无效CD
This commit is contained in:
commit
abb932868b
1 changed files with 5 additions and 5 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue