219 lines
7.2 KiB
Go
219 lines
7.2 KiB
Go
package luckygift
|
||
|
||
const (
|
||
DefaultPoolID = "default"
|
||
|
||
StatusDraft = "draft"
|
||
StatusActive = "active"
|
||
StatusPaused = "paused"
|
||
StatusClosed = "closed"
|
||
StatusPending = "pending"
|
||
StatusGranted = "granted"
|
||
StatusFailed = "failed"
|
||
|
||
PoolNovice = "novice"
|
||
PoolIntermediate = "intermediate"
|
||
PoolAdvanced = "advanced"
|
||
|
||
StageNovice = "novice"
|
||
StageNormal = "normal"
|
||
StageAdvanced = "advanced"
|
||
|
||
SourceBaseRTP = "base_rtp"
|
||
SourceRoomAtmosphere = "room_atmosphere"
|
||
SourceActivity = "activity_subsidy"
|
||
SourcePresentation = "presentation_only"
|
||
|
||
BroadcastNone = "none"
|
||
BroadcastRoom = "room"
|
||
BroadcastRegion = "region"
|
||
BroadcastGlobal = "global"
|
||
)
|
||
|
||
// Tier 是单个体验池里的候选奖档;权重只塑造体验节奏,基础成本仍由 RTP 窗口兜住。
|
||
type Tier struct {
|
||
Pool string `json:"pool"`
|
||
TierID string `json:"tier_id"`
|
||
RewardCoins int64 `json:"reward_coins"`
|
||
MultiplierPPM int64 `json:"multiplier_ppm"`
|
||
Weight int64 `json:"weight"`
|
||
HighWaterOnly bool `json:"high_water_only"`
|
||
Enabled bool `json:"enabled"`
|
||
}
|
||
|
||
// Config 是幸运礼物线上规则快照。金额均为整数金币,比例均为 ppm。
|
||
type Config struct {
|
||
AppCode string `json:"app_code"`
|
||
GiftID string `json:"gift_id"`
|
||
PoolID string `json:"pool_id"`
|
||
Enabled bool `json:"enabled"`
|
||
RuleVersion int64 `json:"rule_version"`
|
||
GiftPrice int64 `json:"gift_price"`
|
||
TargetRTPPPM int64 `json:"target_rtp_ppm"`
|
||
PoolRatePPM int64 `json:"pool_rate_ppm"`
|
||
GlobalWindowDraws int64 `json:"global_window_draws"`
|
||
GiftWindowDraws int64 `json:"gift_window_draws"`
|
||
NoviceDrawLimit int64 `json:"novice_draw_limit"`
|
||
IntermediateDrawLimit int64 `json:"intermediate_draw_limit"`
|
||
HighMultiplier int64 `json:"high_multiplier"`
|
||
HighWaterPoolMultiple int64 `json:"high_water_pool_multiple"`
|
||
PlatformPoolWeightPPM int64 `json:"platform_pool_weight_ppm"`
|
||
RoomPoolWeightPPM int64 `json:"room_pool_weight_ppm"`
|
||
GiftPoolWeightPPM int64 `json:"gift_pool_weight_ppm"`
|
||
InitialPlatformPool int64 `json:"initial_platform_pool"`
|
||
InitialGiftPool int64 `json:"initial_gift_pool"`
|
||
InitialRoomPool int64 `json:"initial_room_pool"`
|
||
PlatformReserve int64 `json:"platform_reserve"`
|
||
GiftReserve int64 `json:"gift_reserve"`
|
||
RoomReserve int64 `json:"room_reserve"`
|
||
MaxSinglePayout int64 `json:"max_single_payout"`
|
||
UserHourlyPayoutCap int64 `json:"user_hourly_payout_cap"`
|
||
UserDailyPayoutCap int64 `json:"user_daily_payout_cap"`
|
||
DeviceDailyPayoutCap int64 `json:"device_daily_payout_cap"`
|
||
RoomHourlyPayoutCap int64 `json:"room_hourly_payout_cap"`
|
||
AnchorDailyPayoutCap int64 `json:"anchor_daily_payout_cap"`
|
||
RoomAtmosphereRatePPM int64 `json:"room_atmosphere_rate_ppm"`
|
||
RoomAtmosphereInitial int64 `json:"room_atmosphere_initial"`
|
||
RoomAtmosphereReserve int64 `json:"room_atmosphere_reserve"`
|
||
ActivityBudget int64 `json:"activity_budget"`
|
||
ActivityDailyLimit int64 `json:"activity_daily_limit"`
|
||
LargeTierEnabled bool `json:"large_tier_enabled"`
|
||
MultiplierPPMs []int64 `json:"multiplier_ppms"`
|
||
Tiers []Tier `json:"tiers"`
|
||
UpdatedByAdminID int64 `json:"updated_by_admin_id"`
|
||
CreatedAtMS int64 `json:"created_at_ms"`
|
||
UpdatedAtMS int64 `json:"updated_at_ms"`
|
||
}
|
||
|
||
// RuleTier 是 v2 配置契约里的阶段奖档。倍率和概率在服务端内部统一用 ppm 保存。
|
||
type RuleTier struct {
|
||
Stage string `json:"stage"`
|
||
TierID string `json:"tier_id"`
|
||
MultiplierPPM int64 `json:"multiplier_ppm"`
|
||
BaseWeightPPM int64 `json:"base_weight_ppm"`
|
||
RewardSource string `json:"reward_source"`
|
||
HighWaterOnly bool `json:"high_water_only"`
|
||
BroadcastLevel string `json:"broadcast_level"`
|
||
Enabled bool `json:"enabled"`
|
||
}
|
||
|
||
// RuleStage 保存某个用户阶段的完整奖档概率。每个阶段的基础概率必须合计 1000000。
|
||
type RuleStage struct {
|
||
Stage string `json:"stage"`
|
||
Tiers []RuleTier `json:"tiers"`
|
||
}
|
||
|
||
// RuleConfig 是幸运礼物 v2 配置版本快照。比例和倍率均为 ppm,业务单位转换发生在发布入口。
|
||
type RuleConfig struct {
|
||
AppCode string `json:"app_code"`
|
||
PoolID string `json:"pool_id"`
|
||
RuleVersion int64 `json:"rule_version"`
|
||
Enabled bool `json:"enabled"`
|
||
TargetRTPPPM int64 `json:"target_rtp_ppm"`
|
||
PoolRatePPM int64 `json:"pool_rate_ppm"`
|
||
SettlementWindowWager int64 `json:"settlement_window_wager"`
|
||
ControlBandPPM int64 `json:"control_band_ppm"`
|
||
GiftPriceReference int64 `json:"gift_price_reference"`
|
||
EffectiveFromMS int64 `json:"effective_from_ms"`
|
||
CreatedByAdminID int64 `json:"created_by_admin_id"`
|
||
CreatedAtMS int64 `json:"created_at_ms"`
|
||
Stages []RuleStage `json:"stages"`
|
||
}
|
||
|
||
type CheckCommand struct {
|
||
PoolID string
|
||
GiftID string
|
||
UserID int64
|
||
RoomID string
|
||
}
|
||
|
||
type DrawCommand struct {
|
||
CommandID string
|
||
PoolID string
|
||
UserID int64
|
||
TargetUserID int64
|
||
DeviceID string
|
||
RoomID string
|
||
AnchorID string
|
||
GiftID string
|
||
GiftCount int32
|
||
CoinSpent int64
|
||
PaidAtMS int64
|
||
VisibleRegionID int64
|
||
}
|
||
|
||
type CheckResult struct {
|
||
Enabled bool
|
||
Reason string
|
||
PoolID string
|
||
GiftID string
|
||
GiftPrice int64
|
||
RuleVersion int64
|
||
TargetRTPPPM int64
|
||
ExperiencePool string
|
||
}
|
||
|
||
type DrawResult struct {
|
||
DrawID string
|
||
CommandID string
|
||
PoolID string
|
||
GiftID string
|
||
RuleVersion int64
|
||
ExperiencePool string
|
||
SelectedTierID string
|
||
MultiplierPPM int64
|
||
BaseRewardCoins int64
|
||
RoomAtmosphereRewardCoins int64
|
||
ActivitySubsidyCoins int64
|
||
EffectiveRewardCoins int64
|
||
BudgetSourcesJSON string
|
||
RewardStatus string
|
||
RTPWindowIndex int64
|
||
GiftRTPWindowIndex int64
|
||
GlobalBaseRTPPPM int64
|
||
GiftBaseRTPPPM int64
|
||
StageFeedback bool
|
||
HighMultiplier bool
|
||
CreatedAtMS int64
|
||
}
|
||
|
||
type DrawSummary struct {
|
||
PoolID string
|
||
TotalDraws int64
|
||
UniqueUsers int64
|
||
UniqueRooms int64
|
||
TotalSpentCoins int64
|
||
TotalRewardCoins int64
|
||
BaseRewardCoins int64
|
||
RoomAtmosphereRewardCoins int64
|
||
ActivitySubsidyCoins int64
|
||
ActualRTPPPM int64
|
||
PendingDraws int64
|
||
GrantedDraws int64
|
||
FailedDraws int64
|
||
}
|
||
|
||
type AdminConfigQuery struct {
|
||
PoolID string
|
||
}
|
||
|
||
type DrawQuery struct {
|
||
PoolID string
|
||
GiftID string
|
||
UserID int64
|
||
RoomID string
|
||
Status string
|
||
Page int32
|
||
PageSize int32
|
||
}
|
||
|
||
// DrawOutbox 是幸运礼物抽奖事务写出的异步副作用载体,worker 只消费这个持久事实。
|
||
type DrawOutbox struct {
|
||
AppCode string
|
||
OutboxID string
|
||
EventType string
|
||
PayloadJSON string
|
||
RetryCount int
|
||
CreatedAtMS int64
|
||
}
|