feat(report): 博主名字后面带上账号池的账号状态
Deploy VitePress site to Pages / build (push) Canceled after 0s
Deploy VitePress site to Pages / Deploy (push) Canceled after 0s

账号池服务(192.168.20.220:18050 的 /api/account_pool/accounts)返回每个号的
`nickname` 和 `account_status`(账号正常 / 账号异常 / 作品异常 / 账号安全待提升)。
报表按昵称匹配,在名字后面加括号显示:`周周逛苏州(账号异常)`。

**由后端去取,浏览器不直连** —— token 不该下发到前端,跨域也麻烦。地址和 token 走
环境变量 `MC_ACCOUNT_POOL_URL` / `MC_ACCOUNT_POOL_TOKEN`(已加到服务器 .env,
不进仓库);没配就静默跳过。

细节:
* 缓存 60 秒 —— 报表会被反复刷新,而账号状态是分钟级的;刷新一次就多打一次外部
  接口没有意义;
* 外部服务失败时**保留上一份缓存**,没有缓存就返回空;报表本身绝不能因此打不开;
* 同名不同号时把状态并起来(`A / B`),不静默只留一个;
* 只在抖音平台附加 —— 那套池子管的是抖音号,小红书同名账号不该被误标。

测试 16 条(新增:按昵称附加状态、外部服务挂掉时报表照出)。
This commit is contained in:
butubb
2026-10-22 14:35:59 +08:00
parent 4a15c1485c
commit 4665dac667
3 changed files with 124 additions and 3 deletions
+7 -3
View File
@@ -458,12 +458,16 @@
for (const creator of data.creators) {
const tr = document.createElement('tr');
const th = document.createElement('th');
th.textContent = creator.name;
th.title = creator.name;
// 账号池给的状态挂在名字后面的括号里,例如「周周逛苏州(账号异常)」。
const label = creator.account_status
? creator.name + '(' + creator.account_status + ')'
: creator.name;
th.textContent = label;
th.title = label;
tr.appendChild(th);
for (const day of data.dates) {
const rowCells = data.cells[day] || {};
tr.appendChild(cellNode(rowCells[creator.hash], day, creator.name));
tr.appendChild(cellNode(rowCells[creator.hash], day, label));
}
tbody.appendChild(tr);
}