104 lines
3.9 KiB
HTML
104 lines
3.9 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="zh-CN">
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<title>记录详情</title>
|
||
<link rel="stylesheet" href="/static/static.css">
|
||
</head>
|
||
<body>
|
||
<div class="wrap">
|
||
<header>
|
||
<h1>记录详情 #<span id="rid"></span></h1>
|
||
<nav class="nav"><a href="/runs">返回流水</a><a href="/">首页</a></nav>
|
||
</header>
|
||
<div class="toolbar" id="summary"></div>
|
||
<div class="panel">
|
||
<h3>① 拉取(云端组包 payload_json)</h3>
|
||
<p class="status-msg">云端拉下的原始明文,可能尚未含本机机构字段。</p>
|
||
<pre id="payload"></pre>
|
||
</div>
|
||
<div class="panel">
|
||
<h3>校验 validation_errors</h3>
|
||
<pre id="errors"></pre>
|
||
</div>
|
||
<div class="panel">
|
||
<h3>② 推送明文(加密前组包 JSON)</h3>
|
||
<p class="status-msg">BuildUpload 合并 unitID/organID/organName 后、AES 加密前的业务 JSON。</p>
|
||
<pre id="push-plain"></pre>
|
||
</div>
|
||
<div class="panel">
|
||
<h3>③ 推送请求(转发头 + 密文摘要)</h3>
|
||
<div id="push-req"></div>
|
||
</div>
|
||
<div class="panel">
|
||
<h3>④ 政务云响应</h3>
|
||
<div id="responses"></div>
|
||
</div>
|
||
<div class="panel">
|
||
<h3>⑤ 回调(推断 CallbackItem)</h3>
|
||
<pre id="callback"></pre>
|
||
</div>
|
||
</div>
|
||
<script src="/static/app.js"></script>
|
||
<script>
|
||
const id = qs('id');
|
||
document.getElementById('rid').textContent = id;
|
||
|
||
function showJSON(el, block, emptyHint) {
|
||
if (!block || (!block.raw && !block.formatted)) {
|
||
el.textContent = emptyHint || '(空)';
|
||
return;
|
||
}
|
||
el.textContent = block.valid && block.formatted ? block.formatted : (block.raw || '(空)');
|
||
}
|
||
|
||
async function load() {
|
||
const d = await api('/api/runs/record?id=' + id);
|
||
const r = d.record;
|
||
document.getElementById('summary').innerHTML =
|
||
`锚定日 <b>${esc(r.AnchorDate)}</b> | step <b>${esc(d.step)}</b> | batch_id <b>${r.JobID}</b> | ` +
|
||
`biz_key <code>${esc(r.BizKey)}</code> | 上传 ${badge(r.PushStatus)} | 回调 ${badge(d.callback.CallbackStatus)}`;
|
||
|
||
showJSON(document.getElementById('payload'), d.payload);
|
||
showJSON(document.getElementById('errors'), d.errors);
|
||
|
||
const plainEl = document.getElementById('push-plain');
|
||
if (d.pushPlain && d.pushPlain.raw) {
|
||
showJSON(plainEl, d.pushPlain);
|
||
} else {
|
||
plainEl.textContent = '(历史记录未采集推送明文,请重新执行同步后查看)';
|
||
}
|
||
|
||
const reqEl = document.getElementById('push-req');
|
||
if (!d.logViews || !d.logViews.length) {
|
||
reqEl.innerHTML = '<pre>(无推送日志)</pre>';
|
||
} else {
|
||
reqEl.innerHTML = d.logViews.map((lv, i) => {
|
||
const hdr = lv.headers && lv.headers.valid && lv.headers.formatted ? lv.headers.formatted : (lv.headers && lv.headers.raw) || '(无请求头)';
|
||
const cipher = lv.cipherPreview ? `<p class="status-msg">requestBody 密文摘要(前 200 字符):</p><pre>${esc(lv.cipherPreview)}</pre>` : '';
|
||
return `<div style="margin-bottom:0.75rem"><b>请求 #${i + 1}</b> 密文 body 长度 ${lv.log.RequestBodyLen} 字节${cipher}<p class="status-msg">转发请求头(不含 secret):</p><pre>${esc(hdr)}</pre></div>`;
|
||
}).join('');
|
||
}
|
||
|
||
const respEl = document.getElementById('responses');
|
||
if (!d.logViews || !d.logViews.length) {
|
||
respEl.innerHTML = '<pre>(无)</pre>';
|
||
} else {
|
||
respEl.innerHTML = d.logViews.map((lv, i) => {
|
||
const l = lv.log;
|
||
const respText = lv.response && lv.response.valid && lv.response.formatted ? lv.response.formatted : (lv.response && lv.response.raw) || l.Msg || '';
|
||
return `<div class="panel" style="margin:0.5rem 0;border:none">
|
||
<h3>HTTP ${l.HTTPCode} msgCode ${l.MsgCode && l.MsgCode.Valid ? l.MsgCode.Int64 : '-'} ${l.DurationMs}ms trace ${esc(l.TraceID)}</h3>
|
||
<pre>${esc(respText)}</pre>
|
||
</div>`;
|
||
}).join('');
|
||
}
|
||
|
||
document.getElementById('callback').textContent = JSON.stringify(d.callback, null, 2);
|
||
}
|
||
|
||
load().catch(e => alert(e.message));
|
||
</script>
|
||
</body>
|
||
</html>
|