fix: 部分逻辑

This commit is contained in:
bietiaop 2024-08-19 22:39:21 +08:00
parent 34cd8b15dc
commit 70836ab785
9 changed files with 204 additions and 173 deletions

View file

@ -43,7 +43,6 @@ export class Panel extends ZZZPlugin {
async refreshPanel() {
const uid = await this.getUID();
if (!uid) return;
const lastQueryTime = await redis.get(`ZZZ:PANEL:${uid}:LASTTIME`);
const panelSettings = settings.getConfig('panel');
const coldTime = _.get(panelSettings, 'interval', 300);
@ -51,12 +50,11 @@ export class Panel extends ZZZPlugin {
await this.reply(`${coldTime}秒内只能刷新一次,请稍后再试`);
return false;
}
const { api, deviceFp } = await this.getAPI();
if (!api) return false;
const { api } = await this.getAPI();
await redis.set(`ZZZ:PANEL:${uid}:LASTTIME`, Date.now());
await this.reply('正在刷新面板列表,请稍候...');
await this.getPlayerInfo();
const result = await refreshPanel(this.e, api, uid, deviceFp);
const result = await refreshPanel(this.e, api, uid);
if (!result) {
await this.reply('面板列表刷新失败,请稍后再试');
return false;
@ -70,7 +68,6 @@ export class Panel extends ZZZPlugin {
}
async getCharPanelList() {
const uid = await this.getUID();
if (!uid) return false;
const result = getPanelList(uid);
if (!result) {
await this.reply('未找到面板数据,请先%刷新面板');
@ -81,7 +78,7 @@ export class Panel extends ZZZPlugin {
if (this?.reply) {
this.reply('查询成功,正在下载图片资源,请稍候。');
}
}, 3000);
}, 5000);
for (const item of result) {
await item.get_basic_assets();
}
@ -94,7 +91,6 @@ export class Panel extends ZZZPlugin {
}
async getCharPanel() {
const uid = await this.getUID();
if (!uid) return false;
const reg = new RegExp(`${rulePrefix}(.+)面板$`);
const match = this.e.msg.match(reg);
if (!match) return false;
@ -108,7 +104,7 @@ export class Panel extends ZZZPlugin {
if (this?.reply) {
this.reply('查询成功,正在下载图片资源,请稍候。');
}
}, 3000);
}, 5000);
await data.get_detail_assets();
clearTimeout(timer);
const finalData = {
@ -128,7 +124,6 @@ export class Panel extends ZZZPlugin {
}
async proficiency() {
const uid = await this.getUID();
if (!uid) return false;
const result = getPanelList(uid);
if (!result) {
await this.reply('未找到面板数据,请先%刷新面板');
@ -160,7 +155,7 @@ export class Panel extends ZZZPlugin {
if (this?.reply) {
this.reply('查询成功,正在下载图片资源,请稍候。');
}
}, 3000);
}, 5000);
for (const item of result) {
await item.get_small_basic_assets();
}