优化更新面板异常回复

This commit is contained in:
UCPr 2025-07-18 04:33:39 +08:00
parent a5c6ee4a37
commit 1bbfb8cf0f
2 changed files with 20 additions and 15 deletions

View file

@ -66,7 +66,6 @@ export class Panel extends ZZZPlugin {
const isEnka = this.e.msg.includes('展柜') || !(await getCk(this.e))
let result
if (isEnka) {
await this.reply('正在更新面板列表,请稍候...');
const data = await refreshPanelFromEnka(uid)
.catch(err => err)
if (data instanceof Error) {
@ -82,22 +81,28 @@ export class Panel extends ZZZPlugin {
result = await mergePanel(uid, panelList)
await this.getPlayerInfo(playerInfo)
} else if (typeof data === 'number') {
return this.reply(`Enka服务调用失败状态码${data}${data === 424 ? '\n版本更新后须等待一段时间才可正常使用enka服务' : ''}`);
return this.reply(`Enka服务调用失败状态码${data}`)
}
} else {
const oriReply = this.reply.bind(this);
let errorMsg = '';
this.reply = (msg) => errorMsg += '\n' + msg;
try {
const { api, deviceFp } = await this.getAPI();
await this.reply('正在更新面板列表,请稍候...\n账号异常时可尝试%更新展柜面板所更新角色数据与实际不一致时请提issue');
await oriReply('正在更新面板列表,请稍候...');
await this.getPlayerInfo();
await redis.set(`ZZZ:PANEL:${uid}:LASTTIME`, Date.now());
result = await refreshPanelFunction(api, deviceFp).catch(e => {
this.reply(e.message);
throw e;
});
result = await refreshPanelFunction(api, deviceFp);
} catch (err) {
logger.error('面板列表更新失败:', err);
errorMsg = (err.message || '') + errorMsg;
}
if (!result) {
await this.reply('面板列表更新失败,请稍后再试');
return false;
this.reply = oriReply;
if (errorMsg && !result) {
return this.reply(`面板列表更新失败,请稍后再试或尝试%更新展柜面板:\n${errorMsg.trim()}`);
}
}
if (!result) return false;
const newChar = result.filter(item => item.isNew);
const finalData = {
newChar: newChar.length,

View file

@ -222,7 +222,7 @@
<div class="properties">
<div class="prop-icon {{prop.classname}}"></div>
{{if prop.score !== false}}
<div class="label yellow hit{{prop.base_score * 100}}">
<div class="label yellow hit{{prop.base_score * 100 - (prop.base_score * 100 % 25)}}">
{{else}}
<div class="label yellow">
{{/if}}