From 0e21a3ae83882defc3036aecc4c8e0b267b41ad6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9F=A5=E5=BE=AE?= Date: Wed, 8 Jul 2026 23:35:56 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=95=B0=E6=8D=AE=E6=B5=81=E6=9E=B6?= =?UTF-8?q?=E6=9E=84=E5=AE=A1=E8=AE=A1-22=E4=B8=AA=E8=84=9A=E6=9C=AC?= =?UTF-8?q?=E8=87=AA=E6=8B=89API=E8=BF=9D=E8=A7=84=E6=A0=87=E8=AE=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/mofin_health.html | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/static/mofin_health.html b/static/mofin_health.html index 945cf982..7db73939 100644 --- a/static/mofin_health.html +++ b/static/mofin_health.html @@ -136,13 +136,29 @@ function toggleFt(g) { }); } -function renderDataFlow(entities, jsonFiles) { +function renderDataFlow(entities, jsonFiles, architecture) { // 只显示有写入方或读取方的实体 const filtered = entities.filter(e => (e.writers||[]).length > 0 || (e.readers||[]).length > 0); // 只显示有读写关系的json const jf = jsonFiles.filter(j => (j.readers||[]).length > 0); let html = '
'; + + // 架构违规告警 + const violations = (architecture||{}).price_api_violations || []; + if (violations.length > 0) { + const scripts = [...new Set(violations.map(v => v.script))]; + html += `
`; + html += `
⚠️ 架构违规: ${violations.length}处, ${scripts.length}个脚本自拉API不走live_prices
`; + html += `
预期: price_monitor→live_prices→其他脚本读。以下脚本直接调腾讯API:
`; + html += `
`; + scripts.forEach(s => { + const lines = violations.filter(v => v.script === s).map(v => `L${v.line}`).join(','); + html += `${s} (${lines})`; + }); + html += `
`; + } + html += `显示 ${filtered.length} 个数据表 + ${jf.length} 个JSON文件的读写流向。绿色→写入,蓝色→读取。
`; // 按写入方数量排序,最活跃的排前面 @@ -239,7 +255,8 @@ function loadData() { `数据表: ${d.entities.length} | ` + `孤立${d.entities.filter(e=>e.flow_status==='orphan').length} ` + `写无读${d.entities.filter(e=>e.flow_status==='write_only').length} ` + - `读无写${d.entities.filter(e=>e.flow_status==='read_only').length}`; + `读无写${d.entities.filter(e=>e.flow_status==='read_only').length}` + + `架构⚠️${(d.architecture||{}).violation_count||0}`; // Tab 0: 功能树 document.getElementById('panel0').innerHTML = renderFeatureTree(d.feature_tree); @@ -269,7 +286,7 @@ function loadData() { document.getElementById('panel2').innerHTML = h2; // Tab 3: 数据流 - document.getElementById('panel3').innerHTML = renderDataFlow(d.entities, d.json_files||[]); + document.getElementById('panel3').innerHTML = renderDataFlow(d.entities, d.json_files||[], d.architecture||{}); }) .catch(e => document.getElementById('summary').innerHTML = '❌ 加载失败: ' + e.message); }