Show Adpingid counts per buyer in 投手明细

build_data.py now emits active_ids (Adpingids with spend in the window)
and owned_ids (Adpingids assigned to the buyer, exclusions removed).
active_ids sums to the 覆盖 Adpingid 数 card.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
FANGKK
2026-08-27 14:31:45 +08:00
co-authored by Claude Opus 5
parent d980690ff2
commit 06f701699e
3 changed files with 15 additions and 1 deletions
+4
View File
@@ -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]],
})
+10
View File
@@ -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",
+1 -1
View File
@@ -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=>'<tr><td class="pkg">'+p.pkg+'</td><td class="num">'+usd(p.spend)+'</td></tr>').join('');
return '<div style="margin-bottom:18px"><div class="buyer-name">'+b.name+' <span style="color:var(--sub);font-weight:400">合计 '+usd(b.total)+' · 主要订单 '+b.pkgs[0].pkg+'</span></div><details><summary>展开 '+b.pkgs.length+' 个 Package 明细</summary><table><thead><tr><th>Package</th><th class="num">花费</th></tr></thead><tbody>'+rows+'</tbody></table></details></div>';
return '<div style="margin-bottom:18px"><div class="buyer-name">'+b.name+' <span style="color:var(--sub);font-weight:400">合计 '+usd(b.total)+' · 在投 Adping '+(b.active_ids??'-')+' 个(共负责 '+(b.owned_ids??'-')+' 个)'+' · 主要订单 '+b.pkgs[0].pkg+'</span></div><details><summary>展开 '+b.pkgs.length+' 个 Package 明细</summary><table><thead><tr><th>Package</th><th class="num">花费</th></tr></thead><tbody>'+rows+'</tbody></table></details></div>';
}).join('');
document.getElementById('foot').textContent=d.meta.note;
}