228 lines
5.8 KiB
Go
228 lines
5.8 KiB
Go
package task
|
||
|
||
const (
|
||
TypeDaily = "daily"
|
||
TypeExclusive = "exclusive"
|
||
|
||
SectionDaily = "daily"
|
||
SectionExclusive = "exclusive"
|
||
|
||
CycleLifetime = "lifetime"
|
||
|
||
AudienceAll = "all"
|
||
AudienceNewbie = "newbie"
|
||
|
||
ActionNone = "none"
|
||
ActionRoom = "room"
|
||
ActionRoomRandom = "room_random"
|
||
ActionRoomWindow = "room_window"
|
||
ActionRoomRandomWindow = "room_random_window"
|
||
ActionRoomGame = "room_game"
|
||
ActionRoomRandomGame = "room_random_game"
|
||
ActionExploreGame = "explore_game"
|
||
ActionWallet = "wallet"
|
||
ActionGiftPanel = "gift_panel"
|
||
ActionGiftPanelSpecific = "gift_panel_specific"
|
||
|
||
MetricGameSpendCoin = "game_spend_coin"
|
||
MetricGameDicePlayCount = "game_dice_play_count"
|
||
MetricGameRockPlayCount = "game_rock_play_count"
|
||
MetricGiftSpendCoin = "gift_spend_coin"
|
||
MetricGiftSendCount = "gift_send_count"
|
||
MetricLuckyGiftSpendCoin = "lucky_gift_spend_coin"
|
||
MetricLuckyGiftSendCount = "lucky_gift_send_count"
|
||
MetricRechargeCoin = "recharge_coin"
|
||
MetricCPRelationshipCreated = "cp_relationship_created"
|
||
MetricMicOnlineMinute = "mic_online_minute"
|
||
MetricMoodPublishCount = "mood_publish_count"
|
||
|
||
StatusDraft = "draft"
|
||
StatusActive = "active"
|
||
StatusPaused = "paused"
|
||
StatusArchived = "archived"
|
||
StatusInProgress = "in_progress"
|
||
StatusCompleted = "completed"
|
||
StatusClaimed = "claimed"
|
||
StatusExpired = "expired"
|
||
|
||
ClaimStatusPending = "pending"
|
||
ClaimStatusGranted = "granted"
|
||
ClaimStatusFailed = "failed"
|
||
|
||
EventStatusConsumed = "consumed"
|
||
EventStatusSkipped = "skipped"
|
||
EventStatusFailed = "failed"
|
||
|
||
RewardAssetCoin = "COIN"
|
||
RewardAssetPoint = "POINT"
|
||
)
|
||
|
||
// Definition 是 task_definitions 的当前版本读模型;App 查询只读这张表和用户进度表。
|
||
type Definition struct {
|
||
AppCode string
|
||
TaskID string
|
||
TaskType string
|
||
Category string
|
||
MetricType string
|
||
Title string
|
||
Description string
|
||
AudienceType string
|
||
IconKey string
|
||
IconURL string
|
||
ActionType string
|
||
ActionParam string
|
||
ActionPayloadJSON string
|
||
DimensionFilterJSON string
|
||
TargetValue int64
|
||
TargetUnit string
|
||
RewardCoinAmount int64
|
||
RewardAssetType string
|
||
Status string
|
||
SortOrder int32
|
||
Version int64
|
||
CurrentVersionID int64
|
||
EffectiveFromMS int64
|
||
EffectiveToMS int64
|
||
CreatedByAdminID int64
|
||
UpdatedByAdminID int64
|
||
CreatedAtMS int64
|
||
UpdatedAtMS int64
|
||
}
|
||
|
||
// Progress 是 user_task_progress 的用户维度状态;target/reward 使用创建进度时的任务快照。
|
||
type Progress struct {
|
||
AppCode string
|
||
UserID int64
|
||
TaskID string
|
||
TaskVersionID int64
|
||
CycleKey string
|
||
ProgressValue int64
|
||
TargetValue int64
|
||
RewardCoinAmount int64
|
||
RewardAssetType string
|
||
Status string
|
||
CompletedAtMS int64
|
||
ClaimedAtMS int64
|
||
UpdatedAtMS int64
|
||
}
|
||
|
||
// Item 是 App 任务列表返回前的领域快照。
|
||
type Item struct {
|
||
Definition
|
||
ProgressValue int64
|
||
UserStatus string
|
||
Claimable bool
|
||
TaskDay string
|
||
ServerTimeMS int64
|
||
NextRefreshAtMS int64
|
||
}
|
||
|
||
// Section 是 daily/exclusive 的固定分区。
|
||
type Section struct {
|
||
Section string
|
||
Items []Item
|
||
ServerTimeMS int64
|
||
NextRefreshAtMS int64
|
||
}
|
||
|
||
// ListResult 是 App 任务页的完整只读结果。
|
||
type ListResult struct {
|
||
Sections []Section
|
||
ServerTimeMS int64
|
||
NextRefreshAtMS int64
|
||
}
|
||
|
||
// DefinitionQuery 是后台任务配置列表筛选条件。
|
||
type DefinitionQuery struct {
|
||
TaskType string
|
||
Category string
|
||
Status string
|
||
Keyword string
|
||
Page int32
|
||
PageSize int32
|
||
}
|
||
|
||
// DefinitionCommand 是后台创建/编辑任务定义的命令快照。
|
||
type DefinitionCommand struct {
|
||
TaskID string
|
||
TaskType string
|
||
Category string
|
||
MetricType string
|
||
Title string
|
||
Description string
|
||
AudienceType string
|
||
IconKey string
|
||
IconURL string
|
||
ActionType string
|
||
ActionParam string
|
||
ActionPayloadJSON string
|
||
DimensionFilterJSON string
|
||
TargetValue int64
|
||
TargetUnit string
|
||
RewardCoinAmount int64
|
||
RewardAssetType string
|
||
Status string
|
||
SortOrder int32
|
||
EffectiveFromMS int64
|
||
EffectiveToMS int64
|
||
OperatorAdminID int64
|
||
}
|
||
|
||
// RewardPolicyCommand 是后台 policy instance 发布到 activity 运行侧的任务奖励默认资产快照。
|
||
type RewardPolicyCommand struct {
|
||
InstanceCode string
|
||
TemplateCode string
|
||
TemplateVersion string
|
||
Status string
|
||
RewardAssetType string
|
||
RuleJSON string
|
||
OperatorAdminID int64
|
||
PublishedAtMS int64
|
||
}
|
||
|
||
// Event 是由 wallet/user/room outbox 派生的任务进度事实。
|
||
type Event struct {
|
||
EventID string
|
||
EventType string
|
||
SourceService string
|
||
UserID int64
|
||
MetricType string
|
||
Value int64
|
||
OccurredAtMS int64
|
||
DimensionsJSON string
|
||
}
|
||
|
||
// EventResult 表达事件消费幂等结果。
|
||
type EventResult struct {
|
||
EventID string
|
||
Status string
|
||
MatchedTaskCount int32
|
||
}
|
||
|
||
// ClaimCommand 是用户领取任务奖励的幂等命令。
|
||
type ClaimCommand struct {
|
||
UserID int64
|
||
TaskID string
|
||
TaskType string
|
||
CycleKey string
|
||
CommandID string
|
||
}
|
||
|
||
// Claim 是 task_reward_claims 的领奖事实。
|
||
type Claim struct {
|
||
ClaimID string
|
||
CommandID string
|
||
UserID int64
|
||
TaskID string
|
||
TaskType string
|
||
CycleKey string
|
||
RewardCoinAmount int64
|
||
RewardAssetType string
|
||
WalletCommandID string
|
||
WalletTransactionID string
|
||
Status string
|
||
FailureReason string
|
||
CreatedAtMS int64
|
||
UpdatedAtMS int64
|
||
}
|