feat: 更新CC码监管方案业务版文档,新增摘要、UGC专项、直播专项、存量处置、误判申诉、水印嵌入、CC码生命周期、组织保障等章节;同步macode到cccode重命名及其他代码变更

This commit is contained in:
freedakgmail
2026-07-20 22:25:40 +08:00
parent 9f1e2d0a21
commit eb4a82a877
76 changed files with 2600 additions and 2122 deletions
+9 -9
View File
@@ -14,7 +14,7 @@ import (
// Store 播放事件存储与聚合。
type Store struct {
mu sync.RWMutex
events map[string][]model.PlaybackEvent // maCode -> events
events map[string][]model.PlaybackEvent // ccCode -> events
}
// NewStore 创建播放数据存储。
@@ -29,21 +29,21 @@ func (s *Store) Ingest(events []model.PlaybackEvent) int {
defer s.mu.Unlock()
n := 0
for _, e := range events {
if e.MACode == "" {
if e.CCCode == "" {
continue
}
s.events[e.MACode] = append(s.events[e.MACode], e)
s.events[e.CCCode] = append(s.events[e.CCCode], e)
n++
}
return n
}
// Summary 按 MA 码聚合可信播放数据(需求9-AC2、需求21-AC1)。
func (s *Store) Summary(maCode string) model.PlaybackSummary {
func (s *Store) Summary(ccCode string) model.PlaybackSummary {
s.mu.RLock()
defer s.mu.RUnlock()
sum := model.PlaybackSummary{MACode: maCode, ByPlatform: map[string]model.PlatformMetric{}}
for _, e := range s.events[maCode] {
sum := model.PlaybackSummary{CCCode: ccCode, ByPlatform: map[string]model.PlatformMetric{}}
for _, e := range s.events[ccCode] {
pm := sum.ByPlatform[e.PlatformID]
switch e.EventType {
case model.EventPlay:
@@ -62,12 +62,12 @@ func (s *Store) Summary(maCode string) model.PlaybackSummary {
// ComputeSettlement 基于聚合的可信播放收益执行分账(需求21-AC3)。
// 分账依据明确标注为"链上可信播放数据",保证 CP 与运营商口径一致。
func (s *Store) ComputeSettlement(maCode, period string, cfg model.RevenueShareConfig) (model.Settlement, error) {
func (s *Store) ComputeSettlement(ccCode, period string, cfg model.RevenueShareConfig) (model.Settlement, error) {
if cfg.CPShareBp+cfg.PlatformShareBp+cfg.HubFeeBp != 10000 {
return model.Settlement{}, fmt.Errorf("playback: share config must sum to 10000bp, got %d",
cfg.CPShareBp+cfg.PlatformShareBp+cfg.HubFeeBp)
}
sum := s.Summary(maCode)
sum := s.Summary(ccCode)
total := sum.TotalRevenue
cp := total * int64(cfg.CPShareBp) / 10000
@@ -76,7 +76,7 @@ func (s *Store) ComputeSettlement(maCode, period string, cfg model.RevenueShareC
hub := total - cp - platform
return model.Settlement{
MACode: maCode, Period: period, TotalRevenue: total,
CCCode: ccCode, Period: period, TotalRevenue: total,
CPShare: cp, PlatformShare: platform, HubFee: hub,
DataSource: "链上可信播放数据",
}, nil