148 lines
3.7 KiB
Go
148 lines
3.7 KiB
Go
package agencyopening
|
||
|
||
const (
|
||
ActivityCode = "agency_opening"
|
||
|
||
StatusDraft = "draft"
|
||
StatusActive = "active"
|
||
StatusDisabled = "disabled"
|
||
StatusSettling = "settling"
|
||
StatusSettled = "settled"
|
||
|
||
ApplicationStatusApplied = "applied"
|
||
ApplicationStatusApproved = "approved"
|
||
ApplicationStatusPending = "pending"
|
||
ApplicationStatusGranted = "granted"
|
||
ApplicationStatusFailed = "failed"
|
||
ApplicationStatusExpired = "expired"
|
||
|
||
EventStatusConsumed = "consumed"
|
||
EventStatusDuplicate = "duplicate"
|
||
EventStatusSkipped = "skipped"
|
||
|
||
GrantSourceAgencyOpening = "agency_opening"
|
||
)
|
||
|
||
// Reward 是代理开业贡献档位;RankNo 只保留为档位展示顺序和旧字段兼容,结算命中只看 ThresholdCoinSpent。
|
||
type Reward struct {
|
||
AppCode string
|
||
CycleID string
|
||
RankNo int32
|
||
ThresholdCoinSpent int64
|
||
RewardCoinAmount int64
|
||
CreatedAtMS int64
|
||
UpdatedAtMS int64
|
||
}
|
||
|
||
// Cycle is the UTC activity window configured by admin.
|
||
type Cycle struct {
|
||
AppCode string
|
||
CycleID string
|
||
ActivityCode string
|
||
Title string
|
||
Status string
|
||
StartMS int64
|
||
EndMS int64
|
||
MinHostCount int32
|
||
MaxAgencyAgeDays int32
|
||
CreatedByAdminID int64
|
||
UpdatedByAdminID int64
|
||
SettledAtMS int64
|
||
CreatedAtMS int64
|
||
UpdatedAtMS int64
|
||
Rewards []Reward
|
||
}
|
||
|
||
// CycleCommand carries an admin mutation after transport normalization.
|
||
type CycleCommand struct {
|
||
Cycle Cycle
|
||
OperatorAdminID int64
|
||
RequireNewRecord bool
|
||
}
|
||
|
||
// ListQuery filters admin list reads.
|
||
type ListQuery struct {
|
||
Status string
|
||
StartMS int64
|
||
EndMS int64
|
||
Page int32
|
||
PageSize int32
|
||
}
|
||
|
||
// Application is both the submitted application record and the settlement fact.
|
||
type Application struct {
|
||
AppCode string
|
||
ApplicationID string
|
||
CycleID string
|
||
AgencyID int64
|
||
AgencyOwnerUserID int64
|
||
AgencyName string
|
||
HostCount int32
|
||
AgencyCreatedAtMS int64
|
||
Status string
|
||
ScoreCoinAmount int64
|
||
RewardRankNo int32
|
||
RewardThresholdCoin int64
|
||
RewardCoinAmount int64
|
||
WalletCommandID string
|
||
WalletTransactionID string
|
||
FailureReason string
|
||
AppliedAtMS int64
|
||
ApprovedAtMS int64
|
||
ScoreStartMS int64
|
||
ScoreEndMS int64
|
||
ReviewedByAdminID int64
|
||
GrantedAtMS int64
|
||
CreatedAtMS int64
|
||
UpdatedAtMS int64
|
||
}
|
||
|
||
// ApplicationQuery filters admin and H5 leaderboard reads.
|
||
type ApplicationQuery struct {
|
||
CycleID string
|
||
Status string
|
||
AgencyID int64
|
||
AgencyOwnerUserID int64
|
||
Page int32
|
||
PageSize int32
|
||
}
|
||
|
||
// AgencySnapshot is read from user-service at apply time so the activity record remains auditable.
|
||
type AgencySnapshot struct {
|
||
AgencyID int64
|
||
OwnerUserID int64
|
||
Name string
|
||
Status string
|
||
HostCount int32
|
||
AgencyCreatedAtMS int64
|
||
}
|
||
|
||
// Qualification combines the current cycle, agency snapshot and application state for H5.
|
||
type Qualification struct {
|
||
Cycle Cycle
|
||
Application Application
|
||
Agency AgencySnapshot
|
||
Enabled bool
|
||
Eligible bool
|
||
Joined bool
|
||
IneligibleReason string
|
||
ServerTimeMS int64
|
||
}
|
||
|
||
// GiftEvent is the room-service gift fact projected into the applicant room owner's opening revenue.
|
||
// CoinSpent keeps the legacy field name but stores RoomGiftSent.gift_value/HeatValue.
|
||
type GiftEvent struct {
|
||
EventID string
|
||
RoomID string
|
||
RoomOwnerUserID int64
|
||
TargetUserID int64
|
||
CoinSpent int64
|
||
OccurredAtMS int64
|
||
}
|
||
|
||
// EventResult describes idempotent revenue consumption for one room event.
|
||
type EventResult struct {
|
||
EventID string
|
||
Status string
|
||
}
|