From 2cce8f94c9ffc552e15830885851a910e14433f1 Mon Sep 17 00:00:00 2001 From: Roe-xin Date: Tue, 3 Mar 2026 18:48:30 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E8=AF=95=E7=94=A8?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=97=A0=E8=BF=87=E6=9C=9F=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E6=97=B6=E6=AC=A2=E8=BF=8E=E5=BC=B9=E7=AA=97=E4=B8=8D=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 优化欢迎弹窗判断逻辑,支持无过期时间的长期试用用户 - 只有在有过期时间且已过期时才不显示欢迎弹窗 - 改进日志输出,更清晰地显示判断流 --- src/panels/ICHelperPanel.ts | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/panels/ICHelperPanel.ts b/src/panels/ICHelperPanel.ts index 7823193..db6c137 100644 --- a/src/panels/ICHelperPanel.ts +++ b/src/panels/ICHelperPanel.ts @@ -547,22 +547,31 @@ export async function showICHelperPanel( console.log("[ICHelperPanel] pluginTrialExpiresAt:", userInfo?.pluginTrialExpiresAt); console.log("[ICHelperPanel] hasWelcomed:", hasWelcomed); - if (userInfo?.isPluginTrial === true && userInfo.pluginTrialExpiresAt !== null && userInfo.pluginTrialExpiresAt !== undefined) { - const now = Date.now(); - const isExpired = now >= userInfo.pluginTrialExpiresAt; - console.log("[ICHelperPanel] 是否过期:", isExpired); + if (userInfo?.isPluginTrial === true) { + // 如果有过期时间,检查是否过期 + if (userInfo.pluginTrialExpiresAt) { + const now = Date.now(); + const isExpired = now >= userInfo.pluginTrialExpiresAt; + console.log("[ICHelperPanel] 是否过期:", isExpired); - if (!isExpired && !hasWelcomed) { + if (isExpired) { + console.log("[ICHelperPanel] 试用已过期,不显示欢迎弹窗"); + break; + } + } + + // 未过期或无过期时间,且未显示过欢迎弹窗 + if (!hasWelcomed) { await context.globalState.update("pluginTrialWelcomed", true); console.log("[ICHelperPanel] ✅ 发送 showWelcomeModal 命令到前端"); panel.webview.postMessage({ command: "showWelcomeModal", }); } else { - console.log("[ICHelperPanel] 已过期或已显示过欢迎弹窗"); + console.log("[ICHelperPanel] 已显示过欢迎弹窗"); } } else { - console.log("[ICHelperPanel] 非试用用户或无过期时间"); + console.log("[ICHelperPanel] 非试用用户"); } } break;