docs(tng): 补充 Money Packet 领取台说明,并同步自动拉详情 Hook

说明 activityId、手动缓存模板后再自动拉历史详情的流程,以及 /mmp 双通道与去重行为。
This commit is contained in:
mars
2026-08-04 15:39:44 +08:00
parent 88a2b319f8
commit 1e2021d8fd
5 changed files with 719 additions and 47 deletions

View File

@@ -371,7 +371,7 @@ def _mmp_html_page():
<main class="main">
<div id="empty" class="empty">
暂无红包数据<br/>
<div class="hint">在手机打开 TNG「红包」详情或排行榜后领取列表会显示在这里</div>
<div class="hint">打开 Money Packet 历史页可自动拉取;若没有数据,先手动点开任意一条详情一次(缓存登录模板),再回历史页</div>
</div>
<div id="panel" style="display:none">
<h2 class="title" id="title">-</h2>
@@ -419,22 +419,26 @@ def _mmp_html_page():
div.className = 'pkt' + (p.packetId === activeId ? ' active' : '');
div.onclick = () => { activeId = p.packetId; loadData(); };
div.innerHTML = `
<div class="pkt-id">${esc((p.sender ? p.sender + ' · ' : '') + 'RM' + (p.sumClaimed ?? p.total ?? 0))}</div>
<div class="pkt-meta">${esc(p.title || '红包')} · ${p.claimantCount || 0} 人领取<br/>
${esc(p.latestAt || '')}
</div>`;
<div class="pkt-id">${esc(shortId(p.packetId))} · ${esc((p.sender || '红包') + ' RM' + (p.sumClaimed ?? p.total ?? 0))}</div>
<div class="pkt-meta">${p.claimantCount || 0} 人领取 · ${esc(p.latestAt || '')}</div>`;
list.appendChild(div);
}
renderActive();
}
function shortId(id) {
const s = String(id || '');
if (s.length >= 8 && s.indexOf('-') > 0) return s.slice(0, 8);
return s.slice(0, 16) || '-';
}
function renderActive() {
const p = packets.find(x => x.packetId === activeId);
if (!p) return;
document.getElementById('title').textContent =
(p.sender ? p.sender + ' 的红包' : (p.title || '红包详情'));
const parts = [];
if (p.packetId && !String(p.packetId).startsWith('红包-')) parts.push('编号 ' + p.packetId);
if (p.packetId) parts.push('activityId ' + p.packetId);
if (p.sender) parts.push('发送人 ' + p.sender);
if (p.group) parts.push('群组 ' + p.group);
if (p.via) parts.push('来源 ' + (p.via === 'http' ? '网络' : p.via === 'gson' ? '解析' : p.via === 'rpc' ? 'RPC' : p.via));