package model import "time" // 播放与分账相关模型(二期 F09/F18,对应需求9/需求21)。 // PlaybackEventType 播放/消费事件类型。 type PlaybackEventType string const ( EventPlay PlaybackEventType = "play" // 播放 EventComplete PlaybackEventType = "complete" // 完播 EventPurchase PlaybackEventType = "purchase" // 购买 ) // PlaybackEvent 运营商以 MA 码为维度回传的播放/消费事件(需求9-AC1)。 type PlaybackEvent struct { MACode string `json:"ma_code"` Episode int `json:"episode"` // 0=整剧/单体 PlatformID string `json:"platform_id"` // 运营商节点 UserHash string `json:"user_hash"` // 用户标识哈希(隐私保护) EventType PlaybackEventType `json:"event_type"` DurationSec int `json:"duration_sec"` RevenueCent int64 `json:"revenue_cent"` // 收益(分),避免浮点 EventTime time.Time `json:"event_time"` } // PlaybackSummary 按 MA 码聚合的可信播放数据(需求9-AC2、需求21-AC1)。 type PlaybackSummary struct { MACode string `json:"ma_code"` TotalPlays int64 `json:"total_plays"` TotalComplete int64 `json:"total_complete"` TotalRevenue int64 `json:"total_revenue_cent"` ByPlatform map[string]PlatformMetric `json:"by_platform"` // 各运营商口径 } // PlatformMetric 单运营商维度指标。 type PlatformMetric struct { Plays int64 `json:"plays"` Complete int64 `json:"complete"` RevenueCent int64 `json:"revenue_cent"` } // RevenueShareConfig 分账比例配置(万分比,合计应为 10000)。 type RevenueShareConfig struct { CPShareBp int `json:"cp_share_bp"` // 内容提供商 PlatformShareBp int `json:"platform_share_bp"` // 运营商/平台 HubFeeBp int `json:"hub_fee_bp"` // 运营主体(陕西IPTV)服务费 } // DefaultShareConfig 默认分账:CP 60% / 平台 34% / 服务费 6%。 func DefaultShareConfig() RevenueShareConfig { return RevenueShareConfig{CPShareBp: 6000, PlatformShareBp: 3400, HubFeeBp: 600} } // Settlement 基于可信播放数据的分账结算结果(需求21-AC3)。 type Settlement struct { MACode string `json:"ma_code"` Period string `json:"period"` TotalRevenue int64 `json:"total_revenue_cent"` CPShare int64 `json:"cp_share_cent"` PlatformShare int64 `json:"platform_share_cent"` HubFee int64 `json:"hub_fee_cent"` DataSource string `json:"data_source"` // 标注依据=链上可信播放数据 }