mirror of
https://github.com/ZZZure/ZZZ-Plugin.git
synced 2025-12-16 21:27:47 +00:00
调整 %更新抽卡记录 的判断顺序,防止出现未绑定cookie时进行更新出现的无效CD
This commit is contained in:
parent
2602647d1b
commit
7ab38101e2
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 lastQueryTime = await redis.get(`ZZZ:GACHA:${uid}:LASTTIME`);
|
||||||
const gachaConfig = settings.getConfig('gacha');
|
const gachaConfig = settings.getConfig('gacha');
|
||||||
const coldTime = _.get(gachaConfig, 'interval', 300);
|
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 {
|
try {
|
||||||
const key = await getAuthKey(this.e, this.User, uid);
|
const key = await getAuthKey(this.e, this.User, uid);
|
||||||
if (!key) {
|
if (!key) {
|
||||||
await this.reply('authKey获取失败,请检查cookie是否过期');
|
await this.reply('authKey获取失败,请检查cookie是否过期');
|
||||||
return false;
|
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);
|
this.getLog(key);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
await this.reply(error.message);
|
await this.reply(error.message);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue