fix: 修复试用用户无过期时间时欢迎弹窗不显示的问题
- 优化欢迎弹窗判断逻辑,支持无过期时间的长期试用用户 - 只有在有过期时间且已过期时才不显示欢迎弹窗 - 改进日志输出,更清晰地显示判断流
This commit is contained in:
@ -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;
|
||||
|
||||
Reference in New Issue
Block a user