feat(phase2): 数据回传聚合与可信分账(F09/F18)
- internal/playback: 播放事件存储/MA码维度聚合/分账结算(CP60/平台34/服务费6) - service: ReportPlayback(链上状态门禁)/PlaybackSummary/ComputeSettlement - api: /data/playback, /data/playback-summary, /settlement/compute - 分账取余兜底无丢分; 未知/已下架MA码回传被拒 - 13项新测试通过; 端到端验证: 回传3条→聚合40元→分账24/13.6/2.4
This commit is contained in:
@@ -12,6 +12,7 @@ import (
|
||||
"github.com/tcs-iptv/tcs/internal/chain"
|
||||
"github.com/tcs-iptv/tcs/internal/macode"
|
||||
"github.com/tcs-iptv/tcs/internal/model"
|
||||
"github.com/tcs-iptv/tcs/internal/playback"
|
||||
)
|
||||
|
||||
// 业务错误。
|
||||
@@ -49,6 +50,7 @@ type SubmissionResult struct {
|
||||
type Service struct {
|
||||
chain chain.Client
|
||||
gen *macode.Generator
|
||||
pb *playback.Store
|
||||
mu sync.Mutex
|
||||
seqMu sync.Mutex
|
||||
seqs map[string]int // 按前缀独立计数(REV/ctid/DIST 各自从 1 递增)
|
||||
@@ -65,7 +67,7 @@ type reviewItem struct {
|
||||
|
||||
// New 创建业务服务。
|
||||
func New(c chain.Client, gen *macode.Generator) *Service {
|
||||
return &Service{chain: c, gen: gen, seqs: make(map[string]int), reviews: make(map[string]*reviewItem)}
|
||||
return &Service{chain: c, gen: gen, pb: playback.NewStore(), seqs: make(map[string]int), reviews: make(map[string]*reviewItem)}
|
||||
}
|
||||
|
||||
func (s *Service) nextID(prefix string) string {
|
||||
|
||||
Reference in New Issue
Block a user