This commit is contained in:
dengqichen 2025-11-17 16:45:46 +08:00
parent 29d96742ac
commit 5e6a0adc73

View File

@ -1056,24 +1056,41 @@ class WindsurfRegister {
await submitButton.click();
logger.success(this.siteName, ' → ✓ 已点击订阅按钮');
// 等待跳转到支付成功页面
// 等待支付处理完成检测离开Stripe页面
logger.info(this.siteName, ' → 等待支付处理...');
try {
await this.page.waitForFunction(
() => window.location.href.includes('/billing/payment-success'),
{ timeout: 60000 }
);
logger.info(this.siteName, ' → 将持续等待直到支付完成(无时间限制)...');
// 记录注册时间(支付成功的时间)
this.registrationTime = new Date();
logger.success(this.siteName, ' → ✓ 支付成功!');
logger.info(this.siteName, ` → 注册时间: ${this.registrationTime.toLocaleString('zh-CN')}`);
const paymentStartTime = Date.now();
let paymentComplete = false;
await this.human.randomDelay(2000, 3000);
} catch (e) {
logger.warn(this.siteName, ` → 等待支付成功页面超时: ${e.message}`);
while (!paymentComplete) {
const currentUrl = this.page.url();
// 检测是否已经离开 Stripe 页面(支付成功的标志)
if (!currentUrl.includes('stripe.com') && !currentUrl.includes('checkout.stripe.com')) {
paymentComplete = true;
const totalTime = ((Date.now() - paymentStartTime) / 1000).toFixed(1);
// 记录注册时间(支付成功的时间)
this.registrationTime = new Date();
logger.success(this.siteName, ` → ✓ 支付成功已离开Stripe页面 (耗时: ${totalTime}秒)`);
logger.info(this.siteName, ` → 当前页面: ${currentUrl}`);
logger.info(this.siteName, ` → 注册时间: ${this.registrationTime.toLocaleString('zh-CN')}`);
break;
}
// 每5秒输出一次进度
const elapsed = Date.now() - paymentStartTime;
if (elapsed > 0 && elapsed % 5000 === 0) {
logger.info(this.siteName, ` → 支付处理中... 已用时 ${(elapsed/1000).toFixed(0)}`);
}
await new Promise(resolve => setTimeout(resolve, 500));
}
// 额外等待页面稳定
await this.human.randomDelay(2000, 3000);
this.currentStep = 6;
logger.success(this.siteName, `步骤 6 完成`);
} else {