125续15l-5: 后台玩家签署情况板块 + 玩家端查看协议原文
- admin.php: 侧边栏加'📜 用户协议'(data-p=rules), go('rules')→loadRules 后台视角=玩家签署情况: 已签总数/当前版本已签/旧版本待重签 + 签署记录倒序表 (玩家名/签署时间/版本状态徽章), 调 api/sync.php?action=rules_content rules目录无.md 时后台提示未配置 - player.php: 侧边栏加'📜 用户协议', switchPage('rules')→renderRules 玩家端视角=查看协议原文: 轻量markdown渲染(标题/列表/加粗/引用/代码/链接), 无外部依赖 展示版本指纹+行数; rules目录无.md 时提示未配置
This commit is contained in:
@@ -209,6 +209,7 @@ if (is_file($ossTxt)) {
|
||||
<div class="si" data-p="cashier_manage" onclick="go('cashier_manage')">🧾 收银员管理</div>
|
||||
<div class="si" data-p="recharge_orders" onclick="go('recharge_orders')">💳 充值对账</div>
|
||||
<div class="si" data-p="shop_config" onclick="go('shop_config')">🛒 充值商店配置</div>
|
||||
<div class="si" data-p="rules" onclick="go('rules')">📜 用户协议</div>
|
||||
<div class="si" onclick="location.href='admin_2fa_setup.php'">🛡️ 安全配置(2FA / IP白名单 / 入口令牌)</div>
|
||||
</div>
|
||||
<div class="content" id="C"></div>
|
||||
@@ -288,6 +289,7 @@ function go(p) {
|
||||
else if (p==='cashier_manage') loadCashierManage(c);
|
||||
else if (p==='recharge_orders') loadRechargeOrders(c);
|
||||
else if (p==='shop_config') loadShopConfig(c);
|
||||
else if (p==='rules') loadRules(c);
|
||||
}
|
||||
|
||||
// 检查登录状态
|
||||
@@ -4480,6 +4482,78 @@ async function loadShopConfig(el) {
|
||||
loadShopConfigData();
|
||||
}
|
||||
|
||||
async function loadRules(el) {
|
||||
el.innerHTML = '<div style="text-align:center;padding:40px;color:var(--dim)">加载中...</div>';
|
||||
try {
|
||||
const res = await fetch('api/sync.php?action=rules_content', {
|
||||
credentials: 'same-origin',
|
||||
headers: { 'Content-Type': 'application/json' }
|
||||
});
|
||||
const data = await res.json();
|
||||
if (!data.success || !data.data) {
|
||||
el.innerHTML = '<div class="card" style="padding:24px">❌ 加载失败:' + esc(data.message || '未知错误') + '</div>';
|
||||
return;
|
||||
}
|
||||
const d = data.data;
|
||||
// 服务器未配置用户协议
|
||||
if (d.skipped || !d.has_agreement) {
|
||||
el.innerHTML = `<div class="card" style="padding:24px">
|
||||
<h2 style="margin:0 0 12px;color:var(--fg)">📜 用户协议 · 玩家签署情况</h2>
|
||||
<p style="color:var(--dim)">服务器未配置用户协议(Web 目录 rules/ 下没有 .md 文件)。</p>
|
||||
<p style="color:var(--dim);margin-top:8px">此时登录页不显示勾选门控,也不要求玩家签章。</p>
|
||||
</div>`;
|
||||
return;
|
||||
}
|
||||
|
||||
const list = d.signed_list || [];
|
||||
const totalSigned = d.total_signed || 0;
|
||||
const curVersion = list.filter(r => r.current_version).length;
|
||||
|
||||
let html = `<div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:16px;flex-wrap:wrap;gap:8px">`;
|
||||
html += `<h2 style="margin:0;color:var(--fg)">📜 用户协议 · 玩家签署情况</h2>`;
|
||||
html += `<div style="display:flex;gap:8px">`;
|
||||
html += `<button onclick="loadRules(document.getElementById('C'))" style="padding:6px 12px;background:var(--card);color:var(--dim);border:1px solid var(--border);border-radius:4px;cursor:pointer;font-size:12px">🔄 刷新</button>`;
|
||||
html += `</div></div>`;
|
||||
|
||||
html += '<div class="dash-stats">';
|
||||
html += `<div class="dash-stat"><div class="v blue">${totalSigned}</div><div class="l">已签署玩家</div></div>`;
|
||||
html += `<div class="dash-stat"><div class="v green">${curVersion}</div><div class="l">当前版本已签</div></div>`;
|
||||
html += `<div class="dash-stat"><div class="v yellow">${totalSigned - curVersion}</div><div class="l">旧版本待重签</div></div>`;
|
||||
html += `</div>`;
|
||||
|
||||
// 协议元信息
|
||||
html += '<div class="card" style="margin-bottom:16px"><h3 style="margin:0 0 10px;font-size:14px">当前协议</h3>';
|
||||
html += `<p style="color:var(--text);font-size:13px">协议标题:${esc(d.title || '(无)')}<br>`;
|
||||
html += `<span style="color:var(--dim);font-size:12px">版本指纹:${esc(d.fingerprint || '')} | 共 ${d.line_count || 0} 行</span></p>`;
|
||||
html += `<p style="color:var(--dim);font-size:12px;margin-top:8px">玩家端可通过登录页「查看协议原文」或 /rules 阅读正文;后台此处仅监控签署进度。</p>`;
|
||||
html += '</div>';
|
||||
|
||||
// 签署清单表
|
||||
html += '<div class="card"><h3 style="margin:0 0 12px;font-size:14px">签署记录(按签署时间倒序,最多显示 200 条)</h3>';
|
||||
if (list.length === 0) {
|
||||
html += '<p style="color:var(--dim);font-size:13px;padding:12px">暂无玩家签署记录。玩家登录 Web 端并勾选「已阅用户协议」后,此处将生成签章回执并在此登记。</p>';
|
||||
} else {
|
||||
html += '<table style="width:100%;border-collapse:collapse;font-size:13px">';
|
||||
html += '<thead><tr style="color:var(--dim);text-align:left"><th style="padding:8px;border-bottom:1px solid var(--border)">玩家</th><th style="padding:8px;border-bottom:1px solid var(--border)">签署时间</th><th style="padding:8px;border-bottom:1px solid var(--border)">版本状态</th></tr></thead><tbody>';
|
||||
for (const r of list) {
|
||||
const when = r.signed_at > 0 ? new Date(r.signed_at * 1000).toLocaleString('zh-CN') : '未知';
|
||||
const verBadge = r.current_version
|
||||
? '<span style="color:var(--green)">✔ 当前版本</span>'
|
||||
: '<span style="color:var(--yellow)">⚠ 旧版本(协议已更新,需重签)</span>';
|
||||
html += `<tr><td style="padding:8px;border-bottom:1px solid var(--border);color:var(--text);font-weight:600">${esc(r.player)}</td>`
|
||||
+ `<td style="padding:8px;border-bottom:1px solid var(--border);color:var(--dim)">${when}</td>`
|
||||
+ `<td style="padding:8px;border-bottom:1px solid var(--border)">${verBadge}</td></tr>`;
|
||||
}
|
||||
html += '</tbody></table>';
|
||||
}
|
||||
html += '</div>';
|
||||
|
||||
el.innerHTML = html;
|
||||
} catch (e) {
|
||||
el.innerHTML = '<div class="card" style="padding:24px;color:var(--red)">加载失败:' + esc(e.message) + '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
async function loadShopConfigData() {
|
||||
const el = document.getElementById('shopConfigList');
|
||||
if (!el) return;
|
||||
|
||||
Reference in New Issue
Block a user