优化项目架构

This commit is contained in:
yml2213
2026-06-19 11:30:19 +08:00
parent dc401afd26
commit 4a5669963f
15 changed files with 1548 additions and 1302 deletions
+23 -26
View File
@@ -232,13 +232,10 @@
tasks.push((async (idx) => {
let a = accounts[idx];
try {
console.log('账号对象:', JSON.stringify(a));
console.log('Cookie长度:', a.cookie?.length, '前50字符:', a.cookie?.substring(0, 50));
let d = await apiJSON('/api/query-score', {
method: 'POST',
headers: { 'Content-Type': 'text/plain' },
body: a.cookie
body: a.name
});
let score = (d.score !== undefined && d.score !== null && d.score !== '') ? d.score : 'N/A';
// ✅ 用账号名存积分
@@ -377,10 +374,9 @@
let name = key.substring(key.indexOf('_') + 1);
if (!validNames.has(name)) {
localStorage.removeItem(key);
console.log('清理无效缓存:', key);
}
}
}
}
}
}
renderAccounts();
}
@@ -398,19 +394,19 @@
let statusStr = '-';
if (st === true) statusStr = '✅';
else if (st === false) statusStr = '❌';
return `<tr>
<td>
<label style="display:flex;align-items:center;cursor:pointer" onclick="togAcc(${i})">
<div style="width:18px;height:18px;border-radius:4px;border:2px solid ${isSel ? '#238636' : '#30363d'};background:${isSel ? '#238636' : 'transparent'};display:flex;align-items:center;justify-content:center;transition:.2s">
${isSel ? '<span style="color:#fff;font-size:12px">✓</span>' : ''}
</div>
</label>
</td>
<td style="font-weight:bold">${a.name}</td>
<td class="cookie-td" title="${a.cookie}">${a.cookie}</td>
<td>${prodTag}</td>
<td id="score_${i}">${scoreVal}</td>
<td class="status-td" id="st_${i}">${statusStr}</td>
return `<tr>
<td>
<label style="display:flex;align-items:center;cursor:pointer" onclick="togAcc(${i})">
<div style="width:18px;height:18px;border-radius:4px;border:2px solid ${isSel ? '#238636' : '#30363d'};background:${isSel ? '#238636' : 'transparent'};display:flex;align-items:center;justify-content:center;transition:.2s">
${isSel ? '<span style="color:#fff;font-size:12px">✓</span>' : ''}
</div>
</label>
</td>
<td style="font-weight:bold">${escHtml(a.name)}</td>
<td class="cookie-td" title="${escHtml(a.cookie)}">${escHtml(a.cookie)}</td>
<td>${prodTag}</td>
<td id="score_${i}">${scoreVal}</td>
<td class="status-td" id="st_${i}">${statusStr}</td>
</tr>`;
});
document.getElementById('accTable').innerHTML = h.join('');
@@ -513,11 +509,12 @@
// 每 500ms 刷新一次显示,确保用户能看到接近触发时的状态变化。
countdownTimer = setInterval(() => {
let now = Date.now();
let remain = Math.max(0, Math.ceil((endTime - now) / 1000));
if (remain <= 0) {
badge.textContent = '🚀 触发中...';
stopCountdown();
scheduleActive = false;
let remain = Math.max(0, Math.ceil((endTime - now) / 1000));
if (remain <= 0) {
badge.textContent = '🚀 触发中...';
clearInterval(countdownTimer);
countdownTimer = null;
scheduleActive = false;
document.getElementById('btnSchedule').style.display = 'inline-block';
document.getElementById('btnCancel').style.display = 'none';
// 延迟回调让“触发中”状态短暂停留,避免用户看不到最终状态。