121 lines
3.1 KiB
Go
121 lines
3.1 KiB
Go
package roomturnoverreward
|
||
|
||
const (
|
||
TierStatusActive = "active"
|
||
TierStatusInactive = "inactive"
|
||
|
||
SettlementStatusPending = "pending"
|
||
SettlementStatusGranted = "granted"
|
||
SettlementStatusFailed = "failed"
|
||
|
||
EventStatusConsumed = "consumed"
|
||
EventStatusDuplicate = "duplicate"
|
||
EventStatusSkipped = "skipped"
|
||
)
|
||
|
||
// Tier 是后台配置的房间贡献奖励档位,结算只发命中的最高有效档。
|
||
type Tier struct {
|
||
TierID int64
|
||
TierCode string
|
||
TierName string
|
||
ThresholdCoinSpent int64
|
||
RewardCoinAmount int64
|
||
Status string
|
||
SortOrder int32
|
||
CreatedAtMS int64
|
||
UpdatedAtMS int64
|
||
}
|
||
|
||
// Config 是当前 App 的房间流水奖励配置。
|
||
type Config struct {
|
||
AppCode string
|
||
Enabled bool
|
||
Tiers []Tier
|
||
UpdatedByAdminID int64
|
||
CreatedAtMS int64
|
||
UpdatedAtMS int64
|
||
}
|
||
|
||
// Progress 是单房间单贡献周期的 HeatValue 聚合;CoinSpent 是历史字段名,运行值为房间贡献值。
|
||
type Progress struct {
|
||
AppCode string
|
||
RoomID string
|
||
PeriodStartMS int64
|
||
PeriodEndMS int64
|
||
CoinSpent int64
|
||
LastEventAtMS int64
|
||
CreatedAtMS int64
|
||
UpdatedAtMS int64
|
||
}
|
||
|
||
// RoomGiftEvent 是 room-service RoomGiftSent 事实映射后的最小聚合输入;CoinSpent 字段承载 gift_value/HeatValue。
|
||
type RoomGiftEvent struct {
|
||
EventID string
|
||
EventType string
|
||
AppCode string
|
||
RoomID string
|
||
CoinSpent int64
|
||
OccurredAtMS int64
|
||
}
|
||
|
||
// EventResult 表达房间礼物事件是否参与流水聚合。
|
||
type EventResult struct {
|
||
EventID string
|
||
Status string
|
||
}
|
||
|
||
// Settlement 是某个房间单个贡献周期的奖励发放事实;CoinSpent 字段承载周期 HeatValue。
|
||
type Settlement struct {
|
||
SettlementID string
|
||
AppCode string
|
||
RoomID string
|
||
OwnerUserID int64
|
||
PeriodStartMS int64
|
||
PeriodEndMS int64
|
||
CoinSpent int64
|
||
TierID int64
|
||
TierCode string
|
||
ThresholdCoinSpent int64
|
||
RewardCoinAmount int64
|
||
Status string
|
||
WalletCommandID string
|
||
WalletTransactionID string
|
||
FailureReason string
|
||
SettledAtMS int64
|
||
CreatedAtMS int64
|
||
UpdatedAtMS int64
|
||
}
|
||
|
||
// StatusResult 是 H5 查询当前用户房间流水奖励活动时的展示投影。
|
||
type StatusResult struct {
|
||
Config Config
|
||
RoomID string
|
||
OwnerUserID int64
|
||
PeriodStartMS int64
|
||
PeriodEndMS int64
|
||
CurrentCoinSpent int64
|
||
ExpectedRewardCoinAmount int64
|
||
MatchedTier Tier
|
||
LatestSettlement Settlement
|
||
ServerTimeMS int64
|
||
}
|
||
|
||
// SettlementQuery 是后台结算记录分页筛选条件。
|
||
type SettlementQuery struct {
|
||
Status string
|
||
RoomID string
|
||
OwnerUserID int64
|
||
PeriodStartMS int64
|
||
Page int32
|
||
PageSize int32
|
||
}
|
||
|
||
// BatchResult 汇总 cron 一次处理的 settlement 创建和发币结果。
|
||
type BatchResult struct {
|
||
ClaimedCount int32
|
||
ProcessedCount int32
|
||
SuccessCount int32
|
||
FailureCount int32
|
||
HasMore bool
|
||
}
|