110 lines
2.7 KiB
Go
110 lines
2.7 KiB
Go
package firstrecharge
|
||
|
||
const (
|
||
TierStatusActive = "active"
|
||
TierStatusInactive = "inactive"
|
||
|
||
StatusPending = "pending"
|
||
StatusGranted = "granted"
|
||
StatusFailed = "failed"
|
||
|
||
ReasonEligible = "eligible"
|
||
ReasonNotConfigured = "not_configured"
|
||
ReasonDisabled = "disabled"
|
||
ReasonInvalidConfig = "invalid_config"
|
||
ReasonNotFirst = "not_first_recharge"
|
||
ReasonTierNotMatched = "tier_not_matched"
|
||
ReasonAlreadyGranted = "already_granted"
|
||
ReasonPendingReward = "pending_reward"
|
||
|
||
RechargeEventWalletRecorded = "WalletRechargeRecorded"
|
||
RechargeTypeCoinSeller = "coin_seller_transfer"
|
||
)
|
||
|
||
// Tier 是首冲奖励的金额档位,max_coin_amount=0 表达无上限。
|
||
type Tier struct {
|
||
TierID int64
|
||
TierCode string
|
||
TierName string
|
||
MinCoinAmount int64
|
||
MaxCoinAmount int64
|
||
ResourceGroupID int64
|
||
Status string
|
||
SortOrder int32
|
||
CreatedAtMS int64
|
||
UpdatedAtMS int64
|
||
}
|
||
|
||
// Config 是首冲奖励当前配置;档位快照由 activity-service 持有。
|
||
type Config struct {
|
||
AppCode string
|
||
Enabled bool
|
||
Tiers []Tier
|
||
UpdatedByAdminID int64
|
||
CreatedAtMS int64
|
||
UpdatedAtMS int64
|
||
}
|
||
|
||
// Claim 是首笔充值触发后的发奖事实;app_code + user_id 唯一。
|
||
type Claim struct {
|
||
ClaimID string
|
||
EventID string
|
||
TransactionID string
|
||
CommandID string
|
||
UserID int64
|
||
TierID int64
|
||
TierCode string
|
||
ResourceGroupID int64
|
||
RechargeCoinAmount int64
|
||
RechargeSequence int64
|
||
RechargeType string
|
||
Status string
|
||
WalletCommandID string
|
||
WalletGrantID string
|
||
FailureReason string
|
||
RechargedAtMS int64
|
||
GrantedAtMS int64
|
||
CreatedAtMS int64
|
||
UpdatedAtMS int64
|
||
}
|
||
|
||
// StatusResult 是 App 首冲奖励面板读取的稳定投影。
|
||
type StatusResult struct {
|
||
Enabled bool
|
||
Tiers []Tier
|
||
Rewarded bool
|
||
Claim Claim
|
||
ServerTimeMS int64
|
||
}
|
||
|
||
// RechargeEvent 是 wallet_outbox 中的成功充值事实。
|
||
type RechargeEvent struct {
|
||
AppCode string
|
||
EventID string
|
||
EventType string
|
||
TransactionID string
|
||
CommandID string
|
||
UserID int64
|
||
RechargeCoinAmount int64
|
||
RechargeSequence int64
|
||
RechargeType string
|
||
PayloadJSON string
|
||
OccurredAtMS int64
|
||
}
|
||
|
||
// PrepareResult 表达 activity 事务是否已经创建或复用 pending claim。
|
||
type PrepareResult struct {
|
||
Claim Claim
|
||
Prepared bool
|
||
AlreadyGranted bool
|
||
Reason string
|
||
}
|
||
|
||
// ClaimQuery 是后台发放记录分页查询条件。
|
||
type ClaimQuery struct {
|
||
Status string
|
||
UserID int64
|
||
Page int32
|
||
PageSize int32
|
||
}
|