Commit Graph

4 Commits

Author SHA1 Message Date
浅念 59de51c062 feat: 来源归因规则引擎(渠道/AI/搜索词/诚实状态/历史重算)
- constants 规则库 v1:AI/引擎/社交域名表、搜索词参数白名单、付费点击参数、
  应用内 UA 标记、CHANNELS 枚举;page_view 白名单开 nav_type/prerendering
- services/attribution.classify 纯函数:付费>AI>引擎>社交>referral 分层,
  UTM 证据叠加(combined/conflict/label_only),应用内 UA 叠加/兜底,
  引擎 TLD 国家 variant,搜索词白名单提取(Google 恒空不虚构)
- SourceClassification 派生表(迁移 0004):first_touch/session_entry 双 scope,
  rule_version 可追溯
- ingest 增量 best-effort:首访客/新会话时分类落库(savepoint+静默,
  失败不影响采集);validation 对 page_view referrer 完整 URL 参数清洗+截500
- recompute_attribution 命令:全量/按站幂等重算
- API:访客列表归因五字段+channel 筛选、详情 attribution 块(含最近5会话入口)、
  dashboard channels 聚合(sources 原口径保留);TS VisitorListParams 加 channel
- 测试 97 → 124(引擎20 + 集成/接口7)

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-09-16 17:03:15 +08:00
浅念 21ca43248a feat: 原始上报数据存储(raw_batch 表/脱敏/访客关联/详情页 Tab/30天清理)
Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-09-16 15:42:06 +08:00
浅念 77a7f568b2 fix: new_visitors 排爬虫+日界/爬虫口径回归测试
- refresh_daily new_visitors 加 is_bot=False(爬虫不是受众,四指标口径统一)
- test_refresh_daily_shanghai_boundary:固定 UTC 时间戳钉死上海自然日界
- test_refresh_daily_excludes_bots:事件/会话/访客 is_bot 均不计入
- refresh_stats 删未使用的 stat = 赋值

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-09-15 13:55:13 +08:00
浅念 cc1ea6805b feat: 日聚合服务与命令 + 索引迁移打包(Task3 审查结论)
- refresh_daily:按上海自然日聚合 pv/uv/sessions/new_visitors,update_or_create 幂等
- refresh_stats 管理命令:回刷近 N 天(生产由 1Panel 每日 00:10 调度,见 Task 22)
- 索引打包(0002):Event/VisitSession 增加 (site, 时间) 日聚合索引;
  删 5 个冗余单列 FK 索引(Event.site/session、VisitSession.site/visitor、DailyStat.site),
  保留 Event.visitor/Visitor.site;sqlite PRAGMA 实证级联索引完整、EXPLAIN 走新索引
- test_models:IntegrityError 断言收紧 + Site 级联删除测试

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-09-15 13:38:01 +08:00