diff --git a/build_data.py b/build_data.py index 4ad9618..227fce0 100644 --- a/build_data.py +++ b/build_data.py @@ -33,6 +33,8 @@ for r in wb['投手'].iter_rows(min_row=2, values_only=True): continue amap[k] = b.lstrip('@').strip() +owned = collections.Counter(amap.values()) # 每位投手名下的 Adpingid 数(已扣除排除包名) + # --- 平台消耗统计 --- rows = [] for r in wb['平台消耗统计'].iter_rows(min_row=2, values_only=True): @@ -73,6 +75,8 @@ for b, pk in buyers.items(): out.append({ "name": b, "@name": b, "total": round(sum(pk.values()), 4), + "active_ids": len(ids[b]), # 本周期内有消耗的 Adpingid 数 + "owned_ids": owned[b], # 名下负责的 Adpingid 总数 "pkgs": [{"pkg": k, "spend": round(v, 4)} for k, v in sorted(pk.items(), key=lambda x: -x[1])[:5]], }) diff --git a/data.json b/data.json index e815ef2..ef294d3 100644 --- a/data.json +++ b/data.json @@ -13,6 +13,8 @@ "name": "黄政", "@name": "黄政", "total": 3677.2527, + "active_ids": 30, + "owned_ids": 132, "pkgs": [ { "pkg": "com.amazon.mShop.android.shopping", @@ -40,6 +42,8 @@ "name": "谭超", "@name": "谭超", "total": 2492.642, + "active_ids": 23, + "owned_ids": 124, "pkgs": [ { "pkg": "com.kwai.bulldog", @@ -67,6 +71,8 @@ "name": "万科", "@name": "万科", "total": 2131.5583, + "active_ids": 23, + "owned_ids": 111, "pkgs": [ { "pkg": "ru.aliexpress.buyer", @@ -94,6 +100,8 @@ "name": "周梓君", "@name": "周梓君", "total": 1612.5096, + "active_ids": 28, + "owned_ids": 118, "pkgs": [ { "pkg": "ru.kinopoisk", @@ -121,6 +129,8 @@ "name": "詹涵粤", "@name": "詹涵粤", "total": 1463.7954, + "active_ids": 23, + "owned_ids": 147, "pkgs": [ { "pkg": "com.king.candycrushsaga", diff --git a/index.html b/index.html index 4566cc7..4acfd95 100644 --- a/index.html +++ b/index.html @@ -74,7 +74,7 @@ function render(d){ new Chart(document.getElementById('pkgChart'),{type:'bar',data:{labels:buyers.map(b=>b.name),datasets:[{label:'主要Package花费',data:buyers.map(b=>b.pkgs[0].spend),backgroundColor:'#4dd6a8'}]},options:{plugins:{legend:{display:false},tooltip:{callbacks:{label:(c)=>usd(c.parsed.y),afterLabel:(ctx)=>buyers[ctx.dataIndex].pkgs[0].pkg}}},scales:{x:{ticks:{color:'#111111'},grid:{display:false}},y:{ticks:{color:'#5b6472',callback:axisUsd},grid:{color:'#d6e2f5'}}}}}); document.getElementById('tables').innerHTML=buyers.map(b=>{ const rows=b.pkgs.map(p=>''+p.pkg+''+usd(p.spend)+'').join(''); - return '
'+b.name+' 合计 '+usd(b.total)+' · 主要订单 '+b.pkgs[0].pkg+'
展开 '+b.pkgs.length+' 个 Package 明细'+rows+'
Package花费
'; + return '
'+b.name+' 合计 '+usd(b.total)+' · 在投 Adping '+(b.active_ids??'-')+' 个(共负责 '+(b.owned_ids??'-')+' 个)'+' · 主要订单 '+b.pkgs[0].pkg+'
展开 '+b.pkgs.length+' 个 Package 明细'+rows+'
Package花费
'; }).join(''); document.getElementById('foot').textContent=d.meta.note; }