Spaces:
Runtime error
Runtime error
Update data.html
Browse files
data.html
CHANGED
|
@@ -10,26 +10,21 @@
|
|
| 10 |
<h1 class="text-3xl font-bold text-slate-900 mb-2 tracking-tight">📋 数据整理</h1>
|
| 11 |
<p class="text-sm text-slate-500 mb-8">粘贴生数据 → 格式清洗 + 去重 → 复制干净列表 → 拿去 CRM/SES 发送</p>
|
| 12 |
|
| 13 |
-
<!-- 退信记录管理 -->
|
| 14 |
<div class="bg-white rounded-2xl shadow-sm border border-slate-200 p-8 space-y-6 mb-8">
|
| 15 |
<h2 class="text-xl font-bold text-slate-800">🚫 退信记录</h2>
|
| 16 |
-
<p class="text-sm text-slate-500">上传
|
| 17 |
<div class="flex flex-wrap gap-3 items-center">
|
| 18 |
-
<input type="file" id="bounceFileInput" accept=".txt" multiple class="text-sm text-slate-600 file:mr-4 file:py-2 file:px-4 file:rounded-lg file:border-0 file:text-sm file:font-semibold file:bg-slate-100 file:text-slate-700 hover:file:bg-slate-200"
|
| 19 |
-
<input type="file" id="sesBounceCsvInput" accept=".csv,.tsv,.txt" class="text-sm text-slate-600 file:mr-4 file:py-2 file:px-4 file:rounded-lg file:border-0 file:text-sm file:font-semibold file:bg-slate-100 file:text-slate-700 hover:file:bg-slate-200" onchange="loadSesBounceCsv(this.files)">
|
| 20 |
<span id="bounceStatus" class="text-xs text-slate-400">已记录 <span id="bounceCount">0</span> 个退信地址</span>
|
| 21 |
<button onclick="clearBounceData()" class="text-xs text-red-500 hover:text-red-700 ml-auto">清空退信记录</button>
|
| 22 |
</div>
|
| 23 |
</div>
|
| 24 |
|
| 25 |
-
<!-- Admin Token -->
|
| 26 |
<div class="bg-white rounded-2xl shadow-sm border border-slate-200 p-8 space-y-6 mb-8">
|
| 27 |
<h2 class="text-xl font-bold text-slate-800">🔑 Admin Token</h2>
|
| 28 |
-
<input type="password" id="adminToken" placeholder="输入 Admin Token(DNS验证时使用)" class="w-full px-4 py-3 border border-slate-300 rounded-xl focus:ring-2 focus:ring-blue-500 focus:outline-none text-sm">
|
| 29 |
</div>
|
| 30 |
|
| 31 |
-
|
| 32 |
-
<!-- 整理区域 -->
|
| 33 |
<div class="bg-white rounded-2xl shadow-sm border border-slate-200 p-8 space-y-6">
|
| 34 |
<div>
|
| 35 |
<label class="block text-sm font-semibold text-slate-700 mb-2">粘贴生数据</label>
|
|
@@ -43,7 +38,6 @@
|
|
| 43 |
</div>
|
| 44 |
<span id="processStatus" class="text-sm text-slate-500"></span>
|
| 45 |
</div>
|
| 46 |
-
<!-- 进度条 -->
|
| 47 |
<div id="progressBar" class="hidden mt-2">
|
| 48 |
<div class="h-2 bg-slate-200 rounded-full overflow-hidden">
|
| 49 |
<div id="progressFill" class="h-full bg-blue-500 transition-all duration-300" style="width:0%"></div>
|
|
@@ -61,25 +55,22 @@
|
|
| 61 |
const BOUNCE_KEY = 'data_bounce_list';
|
| 62 |
const GENERIC_PREFIXES = ['info','admin','support','hr','sales','contact','office','service','webmaster','marketing','business','help','jobs','careers','press','media','news','noreply','no-reply','mail','postmaster','abuse'];
|
| 63 |
|
| 64 |
-
function getBounces() {
|
| 65 |
-
try { return JSON.parse(localStorage.getItem(BOUNCE_KEY) || '[]'); } catch(e) { return []; }
|
| 66 |
-
}
|
| 67 |
function saveBounces(list) { localStorage.setItem(BOUNCE_KEY, JSON.stringify(list)); }
|
| 68 |
async function updateBounceDbCount() {
|
| 69 |
const token = document.getElementById('adminToken').value.trim();
|
| 70 |
if (!token) return;
|
| 71 |
-
try {
|
| 72 |
-
const res = await fetch('/api/crm/bounced_count', { headers: { 'X-Admin-Token': token } });
|
| 73 |
-
const data = await res.json();
|
| 74 |
-
document.getElementById('bounceCount').textContent = data.count || 0;
|
| 75 |
-
} catch(e) {}
|
| 76 |
}
|
| 77 |
function updateBounceCount() { updateBounceDbCount(); }
|
| 78 |
updateBounceCount();
|
| 79 |
|
| 80 |
-
async function
|
|
|
|
|
|
|
| 81 |
const token = document.getElementById('adminToken').value.trim();
|
| 82 |
if (!token) { alert('请先输入 Admin Token'); return; }
|
|
|
|
| 83 |
for (const file of files) {
|
| 84 |
const text = await file.text();
|
| 85 |
const lines = text.split(/[\n\r]+/).filter(l => l.trim());
|
|
@@ -87,42 +78,18 @@
|
|
| 87 |
for (const line of lines) {
|
| 88 |
if (!line.trim() || line.startsWith('收信地址')) continue;
|
| 89 |
const cols = line.split('\t');
|
| 90 |
-
if (cols[0] && cols[0].includes('@')) {
|
| 91 |
-
|
| 92 |
-
}
|
| 93 |
}
|
| 94 |
if (emails.length > 0) {
|
| 95 |
-
await fetch('/api/crm/add_bounced', {
|
| 96 |
-
|
| 97 |
-
headers: { 'X-Admin-Token': token, 'Content-Type': 'application/json' },
|
| 98 |
-
body: JSON.stringify({ emails })
|
| 99 |
-
});
|
| 100 |
-
alert(`已导入 ${emails.length} 个 SES 退信地址到数据库`);
|
| 101 |
-
updateBounceDbCount();
|
| 102 |
}
|
| 103 |
}
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
function loadBounceFiles(files) {
|
| 108 |
-
let bounces = getBounces(), added = 0, processed = 0;
|
| 109 |
-
const total = files.length;
|
| 110 |
-
for (const file of files) {
|
| 111 |
-
const reader = new FileReader();
|
| 112 |
-
reader.onload = function(e) {
|
| 113 |
-
const emails = e.target.result.split(/[\n\r]+/).map(l => l.trim()).filter(l => l && l.includes('@'));
|
| 114 |
-
for (const email of emails) { if (!bounces.includes(email)) { bounces.push(email); added++; } }
|
| 115 |
-
processed++;
|
| 116 |
-
if (processed === total) {
|
| 117 |
-
saveBounces(bounces);
|
| 118 |
-
updateBounceCount();
|
| 119 |
-
document.getElementById('bounceStatus').textContent = `已记录 ${bounces.length} 个退信地址(本次新增 ${added} 个)`;
|
| 120 |
-
document.getElementById('bounceFileInput').value = '';
|
| 121 |
-
}
|
| 122 |
-
};
|
| 123 |
-
reader.readAsText(file);
|
| 124 |
-
}
|
| 125 |
-
}
|
| 126 |
|
| 127 |
function clearBounceData() {
|
| 128 |
if (confirm('确定要清空所有退信记录吗?')) { saveBounces([]); updateBounceCount(); document.getElementById('bounceStatus').textContent = '已记录 0 个退信地址'; }
|
|
@@ -136,58 +103,33 @@
|
|
| 136 |
const progressBar = document.getElementById('progressBar');
|
| 137 |
const progressFill = document.getElementById('progressFill');
|
| 138 |
const progressText = document.getElementById('progressText');
|
| 139 |
-
|
| 140 |
if (!raw.trim()) { status.textContent = '请先粘贴邮箱地址'; status.className = 'text-sm text-red-500'; return; }
|
| 141 |
-
|
| 142 |
btn.disabled = true; btn.textContent = '整理中...';
|
| 143 |
-
progressBar.classList.remove('hidden');
|
| 144 |
-
status.textContent = ''; status.className = 'text-sm text-slate-500';
|
| 145 |
-
|
| 146 |
await sleep(30);
|
| 147 |
-
|
| 148 |
-
// 1. 分割
|
| 149 |
-
updateProgress(10, '分割行...');
|
| 150 |
-
await sleep(20);
|
| 151 |
const normalized = raw.replace(/[,;,;\s]+/g, '\n');
|
| 152 |
const lines = normalized.split(/[\n\r]+/).map(l => l.trim()).filter(l => l);
|
| 153 |
updateProgress(20, `原始 ${lines.length} 行`);
|
| 154 |
-
|
| 155 |
-
// 2. 格式过滤
|
| 156 |
const validFormat = lines.filter(l => l.includes('@') && !l.includes(' '));
|
| 157 |
updateProgress(40, `格式过滤完成,剩余 ${validFormat.length}`);
|
| 158 |
-
|
| 159 |
-
// 3. 过滤通用邮箱
|
| 160 |
const notGeneric = validFormat.filter(l => { const p = l.split('@')[0].toLowerCase(); return !GENERIC_PREFIXES.includes(p); });
|
| 161 |
updateProgress(55, `通用邮箱过滤完成,剩余 ${notGeneric.length}`);
|
| 162 |
-
|
| 163 |
-
// 4. 去重
|
| 164 |
const unique = [...new Set(notGeneric)];
|
| 165 |
updateProgress(70, `去重完成,剩余 ${unique.length}`);
|
| 166 |
-
|
| 167 |
-
// 5. 过滤退信
|
| 168 |
const clean = unique.filter(l => !bouncesSet.has(l));
|
| 169 |
updateProgress(90, `退信过滤完成,剩余 ${clean.length}`);
|
| 170 |
-
|
| 171 |
-
// 结果
|
| 172 |
-
const stats = [
|
| 173 |
-
`原始行数:${lines.length} 条`,
|
| 174 |
-
`格式过滤:去掉 ${lines.length - validFormat.length} 条`,
|
| 175 |
-
`通用邮箱:去掉 ${validFormat.length - notGeneric.length} 条`,
|
| 176 |
-
`本批去重:去掉 ${notGeneric.length - unique.length} 条`,
|
| 177 |
-
`退信过滤:去掉 ${unique.length - clean.length} 条`,
|
| 178 |
-
`最终可用:${clean.length} 条`
|
| 179 |
-
];
|
| 180 |
document.getElementById('resultOutput').value = clean.join('\n');
|
| 181 |
document.getElementById('resultStats').innerHTML = stats.map(s => `<div>${s}</div>`).join('');
|
| 182 |
document.getElementById('resultArea').classList.remove('hidden');
|
| 183 |
document.getElementById('copyBtn').classList.remove('hidden');
|
| 184 |
document.getElementById('verifyBtn').classList.remove('hidden');
|
| 185 |
-
|
| 186 |
updateProgress(100, `完成!最终可用 ${clean.length} 条`);
|
| 187 |
btn.disabled = false; btn.textContent = '🔍 整理';
|
| 188 |
}
|
| 189 |
|
| 190 |
-
|
| 191 |
const token = document.getElementById('adminToken').value.trim();
|
| 192 |
if (!token) { document.getElementById('processStatus').textContent = '请先输入 Admin Token'; document.getElementById('processStatus').className = 'text-sm text-red-500'; return; }
|
| 193 |
const status = document.getElementById('processStatus');
|
|
@@ -196,22 +138,13 @@
|
|
| 196 |
const verifyBtn = document.getElementById('verifyBtn');
|
| 197 |
const emails = resultOutput.value.trim();
|
| 198 |
if (!emails) { status.textContent = '没有可验证的邮箱'; status.className = 'text-sm text-red-500'; return; }
|
| 199 |
-
|
| 200 |
verifyBtn.disabled = true; verifyBtn.textContent = '验证中...';
|
| 201 |
status.textContent = '正在验证 DNS...'; status.className = 'text-sm text-blue-500';
|
| 202 |
-
|
| 203 |
try {
|
| 204 |
const res = await fetch('/api/crm/verify_emails', { method: 'POST', headers: { 'X-Admin-Token': token, 'Content-Type': 'application/json' }, body: JSON.stringify({ emails }) });
|
| 205 |
const data = await res.json();
|
| 206 |
-
if (data.success) {
|
| 207 |
-
|
| 208 |
-
resultStats.innerHTML += `<div class="text-red-500">DNS验证:过滤 ${data.invalid_count} 个无效域名</div>`;
|
| 209 |
-
status.textContent = `DNS验证完成,${data.valid_count} 个有效,${data.invalid_count} 个无效已过滤`;
|
| 210 |
-
status.className = 'text-sm text-emerald-600';
|
| 211 |
-
} else {
|
| 212 |
-
status.textContent = '验证失败';
|
| 213 |
-
status.className = 'text-sm text-red-500';
|
| 214 |
-
}
|
| 215 |
} catch(e) { status.textContent = '网络错误'; status.className = 'text-sm text-red-500'; }
|
| 216 |
finally { verifyBtn.disabled = false; verifyBtn.textContent = '🔍 DNS验证'; }
|
| 217 |
}
|
|
@@ -223,16 +156,10 @@
|
|
| 223 |
const filtered = list.filter(l => !bouncesSet.has(l));
|
| 224 |
document.getElementById('resultOutput').value = filtered.join('\n');
|
| 225 |
if (!filtered.length) { document.getElementById('processStatus').textContent = '所有邮箱都在退信记录中'; document.getElementById('processStatus').className = 'text-sm text-red-500'; return; }
|
| 226 |
-
navigator.clipboard.writeText(filtered.join('\n')).then(() => {
|
| 227 |
-
document.getElementById('processStatus').textContent = '已复制到剪贴板,现在可以去 CRM 或 SES 页面粘贴发送';
|
| 228 |
-
document.getElementById('processStatus').className = 'text-sm text-emerald-600';
|
| 229 |
-
});
|
| 230 |
}
|
| 231 |
|
| 232 |
-
function updateProgress(pct, text) {
|
| 233 |
-
document.getElementById('progressFill').style.width = pct + '%';
|
| 234 |
-
document.getElementById('progressText').textContent = text;
|
| 235 |
-
}
|
| 236 |
function sleep(ms) { return new Promise(r => setTimeout(r, ms)); }
|
| 237 |
</script>
|
| 238 |
</body>
|
|
|
|
| 10 |
<h1 class="text-3xl font-bold text-slate-900 mb-2 tracking-tight">📋 数据整理</h1>
|
| 11 |
<p class="text-sm text-slate-500 mb-8">粘贴生数据 → 格式清洗 + 去重 → 复制干净列表 → 拿去 CRM/SES 发送</p>
|
| 12 |
|
|
|
|
| 13 |
<div class="bg-white rounded-2xl shadow-sm border border-slate-200 p-8 space-y-6 mb-8">
|
| 14 |
<h2 class="text-xl font-bold text-slate-800">🚫 退信记录</h2>
|
| 15 |
+
<p class="text-sm text-slate-500">上传退信 txt 或 SES 退信 CSV,系统自动记住无效地址,下次整理时自动过滤。</p>
|
| 16 |
<div class="flex flex-wrap gap-3 items-center">
|
| 17 |
+
<input type="file" id="bounceFileInput" accept=".txt,.csv,.tsv" multiple class="text-sm text-slate-600 file:mr-4 file:py-2 file:px-4 file:rounded-lg file:border-0 file:text-sm file:font-semibold file:bg-slate-100 file:text-slate-700 hover:file:bg-slate-200">
|
|
|
|
| 18 |
<span id="bounceStatus" class="text-xs text-slate-400">已记录 <span id="bounceCount">0</span> 个退信地址</span>
|
| 19 |
<button onclick="clearBounceData()" class="text-xs text-red-500 hover:text-red-700 ml-auto">清空退信记录</button>
|
| 20 |
</div>
|
| 21 |
</div>
|
| 22 |
|
|
|
|
| 23 |
<div class="bg-white rounded-2xl shadow-sm border border-slate-200 p-8 space-y-6 mb-8">
|
| 24 |
<h2 class="text-xl font-bold text-slate-800">🔑 Admin Token</h2>
|
| 25 |
+
<input type="password" id="adminToken" placeholder="输入 Admin Token(DNS验证/导入退信时使用)" class="w-full px-4 py-3 border border-slate-300 rounded-xl focus:ring-2 focus:ring-blue-500 focus:outline-none text-sm">
|
| 26 |
</div>
|
| 27 |
|
|
|
|
|
|
|
| 28 |
<div class="bg-white rounded-2xl shadow-sm border border-slate-200 p-8 space-y-6">
|
| 29 |
<div>
|
| 30 |
<label class="block text-sm font-semibold text-slate-700 mb-2">粘贴生数据</label>
|
|
|
|
| 38 |
</div>
|
| 39 |
<span id="processStatus" class="text-sm text-slate-500"></span>
|
| 40 |
</div>
|
|
|
|
| 41 |
<div id="progressBar" class="hidden mt-2">
|
| 42 |
<div class="h-2 bg-slate-200 rounded-full overflow-hidden">
|
| 43 |
<div id="progressFill" class="h-full bg-blue-500 transition-all duration-300" style="width:0%"></div>
|
|
|
|
| 55 |
const BOUNCE_KEY = 'data_bounce_list';
|
| 56 |
const GENERIC_PREFIXES = ['info','admin','support','hr','sales','contact','office','service','webmaster','marketing','business','help','jobs','careers','press','media','news','noreply','no-reply','mail','postmaster','abuse'];
|
| 57 |
|
| 58 |
+
function getBounces() { try { return JSON.parse(localStorage.getItem(BOUNCE_KEY) || '[]'); } catch(e) { return []; } }
|
|
|
|
|
|
|
| 59 |
function saveBounces(list) { localStorage.setItem(BOUNCE_KEY, JSON.stringify(list)); }
|
| 60 |
async function updateBounceDbCount() {
|
| 61 |
const token = document.getElementById('adminToken').value.trim();
|
| 62 |
if (!token) return;
|
| 63 |
+
try { const res = await fetch('/api/crm/bounced_count', { headers: { 'X-Admin-Token': token } }); const data = await res.json(); document.getElementById('bounceCount').textContent = data.count || 0; } catch(e) {}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
}
|
| 65 |
function updateBounceCount() { updateBounceDbCount(); }
|
| 66 |
updateBounceCount();
|
| 67 |
|
| 68 |
+
document.getElementById('bounceFileInput').addEventListener('change', async function() {
|
| 69 |
+
const files = this.files;
|
| 70 |
+
if (!files.length) return;
|
| 71 |
const token = document.getElementById('adminToken').value.trim();
|
| 72 |
if (!token) { alert('请先输入 Admin Token'); return; }
|
| 73 |
+
let totalAdded = 0;
|
| 74 |
for (const file of files) {
|
| 75 |
const text = await file.text();
|
| 76 |
const lines = text.split(/[\n\r]+/).filter(l => l.trim());
|
|
|
|
| 78 |
for (const line of lines) {
|
| 79 |
if (!line.trim() || line.startsWith('收信地址')) continue;
|
| 80 |
const cols = line.split('\t');
|
| 81 |
+
if (cols[0] && cols[0].includes('@')) { emails.push(cols[0].trim()); continue; }
|
| 82 |
+
const plain = line.trim();
|
| 83 |
+
if (plain.includes('@') && !plain.includes(' ')) { emails.push(plain); }
|
| 84 |
}
|
| 85 |
if (emails.length > 0) {
|
| 86 |
+
await fetch('/api/crm/add_bounced', { method: 'POST', headers: { 'X-Admin-Token': token, 'Content-Type': 'application/json' }, body: JSON.stringify({ emails }) });
|
| 87 |
+
totalAdded += emails.length;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
}
|
| 89 |
}
|
| 90 |
+
if (totalAdded > 0) { alert(`已导入 ${totalAdded} 个退信地址到数据库`); updateBounceDbCount(); }
|
| 91 |
+
this.value = '';
|
| 92 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
|
| 94 |
function clearBounceData() {
|
| 95 |
if (confirm('确定要清空所有退信记录吗?')) { saveBounces([]); updateBounceCount(); document.getElementById('bounceStatus').textContent = '已记录 0 个退信地址'; }
|
|
|
|
| 103 |
const progressBar = document.getElementById('progressBar');
|
| 104 |
const progressFill = document.getElementById('progressFill');
|
| 105 |
const progressText = document.getElementById('progressText');
|
|
|
|
| 106 |
if (!raw.trim()) { status.textContent = '请先粘贴邮箱地址'; status.className = 'text-sm text-red-500'; return; }
|
|
|
|
| 107 |
btn.disabled = true; btn.textContent = '整理中...';
|
| 108 |
+
progressBar.classList.remove('hidden'); status.textContent = ''; status.className = 'text-sm text-slate-500';
|
|
|
|
|
|
|
| 109 |
await sleep(30);
|
| 110 |
+
updateProgress(10, '分割行...'); await sleep(20);
|
|
|
|
|
|
|
|
|
|
| 111 |
const normalized = raw.replace(/[,;,;\s]+/g, '\n');
|
| 112 |
const lines = normalized.split(/[\n\r]+/).map(l => l.trim()).filter(l => l);
|
| 113 |
updateProgress(20, `原始 ${lines.length} 行`);
|
|
|
|
|
|
|
| 114 |
const validFormat = lines.filter(l => l.includes('@') && !l.includes(' '));
|
| 115 |
updateProgress(40, `格式过滤完成,剩余 ${validFormat.length}`);
|
|
|
|
|
|
|
| 116 |
const notGeneric = validFormat.filter(l => { const p = l.split('@')[0].toLowerCase(); return !GENERIC_PREFIXES.includes(p); });
|
| 117 |
updateProgress(55, `通用邮箱过滤完成,剩余 ${notGeneric.length}`);
|
|
|
|
|
|
|
| 118 |
const unique = [...new Set(notGeneric)];
|
| 119 |
updateProgress(70, `去重完成,剩余 ${unique.length}`);
|
|
|
|
|
|
|
| 120 |
const clean = unique.filter(l => !bouncesSet.has(l));
|
| 121 |
updateProgress(90, `退信过滤完成,剩余 ${clean.length}`);
|
| 122 |
+
const stats = [`原始行数:${lines.length} 条`,`格式过滤:去掉 ${lines.length - validFormat.length} 条`,`通用邮箱:去掉 ${validFormat.length - notGeneric.length} 条`,`本批去重:去掉 ${notGeneric.length - unique.length} 条`,`退信过滤:去掉 ${unique.length - clean.length} 条`,`最终可用:${clean.length} 条`];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 123 |
document.getElementById('resultOutput').value = clean.join('\n');
|
| 124 |
document.getElementById('resultStats').innerHTML = stats.map(s => `<div>${s}</div>`).join('');
|
| 125 |
document.getElementById('resultArea').classList.remove('hidden');
|
| 126 |
document.getElementById('copyBtn').classList.remove('hidden');
|
| 127 |
document.getElementById('verifyBtn').classList.remove('hidden');
|
|
|
|
| 128 |
updateProgress(100, `完成!最终可用 ${clean.length} 条`);
|
| 129 |
btn.disabled = false; btn.textContent = '🔍 整理';
|
| 130 |
}
|
| 131 |
|
| 132 |
+
async function verifyEmails() {
|
| 133 |
const token = document.getElementById('adminToken').value.trim();
|
| 134 |
if (!token) { document.getElementById('processStatus').textContent = '请先输入 Admin Token'; document.getElementById('processStatus').className = 'text-sm text-red-500'; return; }
|
| 135 |
const status = document.getElementById('processStatus');
|
|
|
|
| 138 |
const verifyBtn = document.getElementById('verifyBtn');
|
| 139 |
const emails = resultOutput.value.trim();
|
| 140 |
if (!emails) { status.textContent = '没有可验证的邮箱'; status.className = 'text-sm text-red-500'; return; }
|
|
|
|
| 141 |
verifyBtn.disabled = true; verifyBtn.textContent = '验证中...';
|
| 142 |
status.textContent = '正在验证 DNS...'; status.className = 'text-sm text-blue-500';
|
|
|
|
| 143 |
try {
|
| 144 |
const res = await fetch('/api/crm/verify_emails', { method: 'POST', headers: { 'X-Admin-Token': token, 'Content-Type': 'application/json' }, body: JSON.stringify({ emails }) });
|
| 145 |
const data = await res.json();
|
| 146 |
+
if (data.success) { resultOutput.value = data.valid.join('\n'); resultStats.innerHTML += `<div class="text-red-500">DNS验证:过滤 ${data.invalid_count} 个无效域名</div>`; status.textContent = `DNS验证完成,${data.valid_count} 个有效,${data.invalid_count} 个无效已过滤`; status.className = 'text-sm text-emerald-600'; }
|
| 147 |
+
else { status.textContent = '验证失败'; status.className = 'text-sm text-red-500'; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 148 |
} catch(e) { status.textContent = '网络错误'; status.className = 'text-sm text-red-500'; }
|
| 149 |
finally { verifyBtn.disabled = false; verifyBtn.textContent = '🔍 DNS验证'; }
|
| 150 |
}
|
|
|
|
| 156 |
const filtered = list.filter(l => !bouncesSet.has(l));
|
| 157 |
document.getElementById('resultOutput').value = filtered.join('\n');
|
| 158 |
if (!filtered.length) { document.getElementById('processStatus').textContent = '所有邮箱都在退信记录中'; document.getElementById('processStatus').className = 'text-sm text-red-500'; return; }
|
| 159 |
+
navigator.clipboard.writeText(filtered.join('\n')).then(() => { document.getElementById('processStatus').textContent = '已复制到剪贴板,现在可以去 CRM 或 SES 页面粘贴发送'; document.getElementById('processStatus').className = 'text-sm text-emerald-600'; });
|
|
|
|
|
|
|
|
|
|
| 160 |
}
|
| 161 |
|
| 162 |
+
function updateProgress(pct, text) { document.getElementById('progressFill').style.width = pct + '%'; document.getElementById('progressText').textContent = text; }
|
|
|
|
|
|
|
|
|
|
| 163 |
function sleep(ms) { return new Promise(r => setTimeout(r, ms)); }
|
| 164 |
</script>
|
| 165 |
</body>
|