vault backup: 2026-11-06 20:19:57
This commit is contained in:
1 parent
8901e4f4db
commit
2c6569dbdf
35 files changed
+17455
-326
No files matched your search
@@ -0,0 +1,53 @@
|
||||
import fs from 'node:fs';
|
||||
const j = JSON.parse(fs.readFileSync('.cdp/out/overview-capture.json', 'utf8'));
|
||||
const bodies = j.value.rawBodies;
|
||||
|
||||
const sellers = [], refunds = [];
|
||||
for (const b of bodies) {
|
||||
const t = Number((/t=(\d+)/.exec(b.url) || [])[1] || 0);
|
||||
const p = JSON.parse(b.text);
|
||||
const d = p && p.data && p.data.data;
|
||||
if (!d) continue;
|
||||
if (/singleuser\.seller\.summary/.test(b.url)) sellers.push({ t, d });
|
||||
if (/datacompass\.refund\.summary/.test(b.url)) refunds.push({ t, d });
|
||||
}
|
||||
sellers.sort((a, b) => a.t - b.t);
|
||||
refunds.sort((a, b) => a.t - b.t);
|
||||
|
||||
const L = [];
|
||||
L.push('seller.summary 响应 ' + sellers.length + ' 个(按时间排序,依次应为 近7天 / 近30天 / 近1天)\n');
|
||||
|
||||
sellers.forEach((s, i) => {
|
||||
const gb = s.d.graphBannerBenchData || {};
|
||||
const banners = gb.bannerDataList || [];
|
||||
const graph = gb.graphDataList || [];
|
||||
L.push('########## #' + (i + 1) + ' t=' + s.t + ' ##########');
|
||||
L.push('bannerDataList(' + banners.length + ') keys: ' + (banners[0] ? JSON.stringify(Object.keys(banners[0])) : '-'));
|
||||
L.push('');
|
||||
L.push('--- 核心指标卡 ---');
|
||||
for (const bn of banners) {
|
||||
const name = bn.name || bn.title || bn.metricName || '?';
|
||||
const val = bn.data !== undefined ? bn.data : (bn.value !== undefined ? bn.value : '');
|
||||
const last = bn.lastData !== undefined ? bn.lastData : (bn.lastValue !== undefined ? bn.lastValue : '');
|
||||
const fmt = bn.dataFormat || bn.dataStr || '';
|
||||
const ratio = bn.ratio !== undefined ? bn.ratio : '';
|
||||
L.push(` ${name}: ${val} ${fmt} (对比 ${last} ${bn.lastDataFormat || ''}) 环比=${ratio}`);
|
||||
}
|
||||
L.push('');
|
||||
L.push('--- graphDataList(' + graph.length + ') ---');
|
||||
if (graph.length) {
|
||||
L.push(' keys: ' + JSON.stringify(Object.keys(graph[0])));
|
||||
L.push(' 首: ' + JSON.stringify(graph[0]));
|
||||
L.push(' 末: ' + JSON.stringify(graph[graph.length - 1]));
|
||||
}
|
||||
L.push('');
|
||||
});
|
||||
|
||||
L.push('\n########## refund.summary ##########');
|
||||
refunds.forEach((r, i) => {
|
||||
const d = r.d;
|
||||
const pick = k => (d[k] && typeof d[k] === 'object' ? (d[k].dataStr || d[k].data) : d[k]);
|
||||
L.push(`#${i + 1} t=${r.t} payOrdCnt=${d.payOrdCnt} succRfdCnt=${pick('succRfdCnt')} succRfdAmt=${d.succRfdAmt} succRfdRate=${pick('succRfdRate')} crtRfdCnt=${pick('crtRfdCnt')} refundAmt=${d.crtRfdAmt}`);
|
||||
});
|
||||
|
||||
fs.writeFileSync('.cdp/out/ov-metrics.txt', L.join('\n'), 'utf8');
|
||||
Reference in new issue
Block a user