feat: live module and jenkins pipeline to harbor deploy

This commit is contained in:
Yvan
2026-09-23 17:42:54 +08:00
parent e376ff02aa
commit 53e8599bdd
145 changed files with 8984 additions and 269 deletions
+44
View File
@@ -0,0 +1,44 @@
package analytics
import (
"context"
bizlive "kra/internal/biz/live"
"time"
)
type TrendPoint struct {
Date string
AmountCents int64
}
type GiftRank struct {
RoomID uint
RoomName, AnchorName string
Diamonds int64
}
type Dashboard struct {
RoomTotal, RoomLive, RechargeCents, PaidOrderCount, GiftDiamonds, GiftSendCount, DiamondRateCents int64
RechargeTrend []*TrendPoint
GiftRanking []*GiftRank
}
type Repo interface {
Dashboard(context.Context, time.Time, time.Time) (*Dashboard, error)
}
type Usecase struct {
repo Repo
streams *bizlive.StreamUsecase
}
func NewUsecase(repo Repo, streams *bizlive.StreamUsecase) *Usecase {
return &Usecase{repo: repo, streams: streams}
}
func (uc *Usecase) Get(ctx context.Context, from, to time.Time) (*Dashboard, error) {
v, err := uc.repo.Dashboard(ctx, from, to)
if err != nil {
return nil, err
}
streams, err := uc.streams.List(ctx)
if err == nil {
v.RoomLive = int64(len(streams))
}
return v, nil
}
+5
View File
@@ -0,0 +1,5 @@
package analytics
import "github.com/google/wire"
var ProviderSet = wire.NewSet(NewUsecase)