diff --git a/src/panels/ICHelperPanel.ts b/src/panels/ICHelperPanel.ts index db6c137..71287d2 100644 --- a/src/panels/ICHelperPanel.ts +++ b/src/panels/ICHelperPanel.ts @@ -548,8 +548,15 @@ export async function showICHelperPanel( console.log("[ICHelperPanel] hasWelcomed:", hasWelcomed); if (userInfo?.isPluginTrial === true) { - // 如果有过期时间,检查是否过期 - if (userInfo.pluginTrialExpiresAt) { + // undefined 表示无效,不显示 + if (userInfo.pluginTrialExpiresAt === undefined) { + console.log("[ICHelperPanel] pluginTrialExpiresAt 未设置,不显示欢迎弹窗"); + break; + } + + // null 表示长期有效,显示弹窗 + // 有值则检查是否过期 + if (userInfo.pluginTrialExpiresAt !== null) { const now = Date.now(); const isExpired = now >= userInfo.pluginTrialExpiresAt; console.log("[ICHelperPanel] 是否过期:", isExpired); @@ -560,7 +567,7 @@ export async function showICHelperPanel( } } - // 未过期或无过期时间,且未显示过欢迎弹窗 + // 未过期或长期有效(null),且未显示过欢迎弹窗 if (!hasWelcomed) { await context.globalState.update("pluginTrialWelcomed", true); console.log("[ICHelperPanel] ✅ 发送 showWelcomeModal 命令到前端"); diff --git a/src/services/userService.ts b/src/services/userService.ts index 30c3bf4..3d335d1 100644 --- a/src/services/userService.ts +++ b/src/services/userService.ts @@ -162,10 +162,14 @@ export async function getUserInfo(token: string): Promise { console.log('[UserService] 从 getInfo 接口获取到 isPluginTrial: true'); } - // 获取试用到期时间 - if (response.enterpriseTrialExpires) { + // 获取试用到期时间(null 表示长期有效) + if (response.enterpriseTrialExpires !== undefined) { userInfo.pluginTrialExpiresAt = response.enterpriseTrialExpires; - console.log('[UserService] 试用到期时间:', new Date(response.enterpriseTrialExpires).toLocaleString()); + if (response.enterpriseTrialExpires === null) { + console.log('[UserService] 试用长期有效'); + } else { + console.log('[UserService] 试用到期时间:', new Date(response.enterpriseTrialExpires).toLocaleString()); + } } return userInfo;