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);
}