From 8bb08727b680819ebd6c9c44026870e23dfc273b Mon Sep 17 00:00:00 2001 From: UCPr <2032385471@qq.com> Date: Sun, 21 Sep 2025 00:11:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=8F=E8=88=86/=E5=8D=B1=E5=B1=80=E6=8C=91?= =?UTF-8?q?=E6=88=98=E6=8F=90=E9=86=92=E6=B7=BB=E5=8A=A0`=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E5=91=A8=E6=9C=9F`=E5=92=8C`=E5=88=B7=E6=96=B0?= =?UTF-8?q?=E5=89=A9=E4=BD=99`=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/remind.js | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/apps/remind.js b/apps/remind.js index fc1b756..081e1c2 100644 --- a/apps/remind.js +++ b/apps/remind.js @@ -270,6 +270,17 @@ export class Remind extends ZZZPlugin { } } + getTimeRemaining({ year, month, day, hour, minute, second }) { + const targetDate = new Date(year, month - 1, day, hour, minute, second); + const now = new Date(); + const timeDiff = targetDate - now; + if (timeDiff <= 0) return { days: 0, hours: 0 }; + const totalHours = Math.floor(timeDiff / (1000 * 60 * 60)); + const days = Math.floor(totalHours / 24); + const hours = totalHours % 24; + return { days, hours }; + } + async checkUser(userId, userConfig, showAll = false, contextE = null) { let messages = []; @@ -293,6 +304,7 @@ export class Remind extends ZZZPlugin { // 检查式舆防卫战 try { const abyssRawData = await api.getFinalData('zzzChallenge', { deviceFp }); + const len = messages.length; if (!abyssRawData || !abyssRawData.has_data) { messages.push('式舆防卫战S评级: 0/7'); } else { @@ -303,6 +315,12 @@ export class Remind extends ZZZPlugin { messages.push(`式舆防卫战S评级: ${sCount}/7${status}`); } } + if (len !== messages.length && abyssRawData?.hadal_begin_time && abyssRawData?.hadal_end_time) { + const { hadal_begin_time, hadal_end_time } = abyssRawData; + const { days, hours } = this.getTimeRemaining(hadal_end_time); + messages.push(`统计周期:${hadal_begin_time.year}/${hadal_begin_time.month}/${hadal_begin_time.day} - ${hadal_end_time.year}/${hadal_end_time.month}/${hadal_end_time.day}`); + messages.push(`刷新剩余: ${days}天${hours}小时`); + } } catch (error) { logger.error(`[ZZZ-Plugin] 为用户 ${userId} 检查式舆防卫战失败: ${error}`); messages.push(`式舆防卫战查询失败: ${error}`); @@ -311,16 +329,23 @@ export class Remind extends ZZZPlugin { // 检查危局强袭战 try { const deadlyRawData = await api.getFinalData('zzzDeadly', { deviceFp }); + const len = messages.length; if (!deadlyRawData || !deadlyRawData.has_data) { - messages.push('危局强袭战星星: 0/9'); + messages.push('危局强袭战星数: 0/9'); } else { const deadlyStars = userConfig.deadlyStars ?? defaultConfig.deadlyStars; const totalStar = deadlyRawData.total_star || 0; const status = totalStar >= deadlyStars ? ' ✓' : ''; if (showAll || totalStar < deadlyStars) { - messages.push(`危局强袭战星星: ${totalStar}/9${status}`); + messages.push(`危局强袭战星数: ${totalStar}/9${status}`); } } + if (len !== messages.length && deadlyRawData?.start_time && deadlyRawData?.end_time) { + const { start_time, end_time } = deadlyRawData; + const { days, hours } = this.getTimeRemaining(end_time); + messages.push(`统计周期:${start_time.year}/${start_time.month}/${start_time.day} - ${end_time.year}/${end_time.month}/${end_time.day}`); + messages.push(`刷新剩余: ${days}天${hours}小时`); + } } catch (error) { logger.error(`[ZZZ-Plugin] 为用户 ${userId} 检查危局强袭战失败: ${error}`); messages.push(`危局强袭战查询失败: ${error}`);