68 lines
4.5 KiB
Go
68 lines
4.5 KiB
Go
package model
|
|
|
|
import "time"
|
|
|
|
// RechargeRewardConfig 保存充值奖励活动的系统级配置。
|
|
type RechargeRewardConfig struct {
|
|
ID int64 `gorm:"column:id;primaryKey"`
|
|
SysOrigin string `gorm:"column:sys_origin;size:32;uniqueIndex:uk_recharge_reward_sys_origin"`
|
|
Enabled bool `gorm:"column:enabled;index:idx_recharge_reward_enabled"`
|
|
Timezone string `gorm:"column:timezone;size:64"`
|
|
CreateTime time.Time `gorm:"column:create_time"`
|
|
UpdateTime time.Time `gorm:"column:update_time"`
|
|
}
|
|
|
|
func (RechargeRewardConfig) TableName() string { return "recharge_reward_config" }
|
|
|
|
// RechargeRewardLevel 保存达到某个充值门槛后展示的奖励配置。
|
|
type RechargeRewardLevel struct {
|
|
ID int64 `gorm:"column:id;primaryKey"`
|
|
ConfigID int64 `gorm:"column:config_id;uniqueIndex:uk_recharge_reward_level,priority:1;uniqueIndex:uk_recharge_reward_amount,priority:1;index:idx_recharge_reward_level_config"`
|
|
Level int `gorm:"column:level;uniqueIndex:uk_recharge_reward_level,priority:2"`
|
|
RechargeAmountCents int64 `gorm:"column:recharge_amount_cents;uniqueIndex:uk_recharge_reward_amount,priority:2"`
|
|
RewardGold int64 `gorm:"column:reward_gold"`
|
|
RewardGroupID *int64 `gorm:"column:reward_group_id"`
|
|
RewardGroupName string `gorm:"column:reward_group_name;size:255"`
|
|
Enabled bool `gorm:"column:enabled"`
|
|
CreateTime time.Time `gorm:"column:create_time"`
|
|
UpdateTime time.Time `gorm:"column:update_time"`
|
|
}
|
|
|
|
func (RechargeRewardLevel) TableName() string { return "recharge_reward_level" }
|
|
|
|
// RechargeRewardGrantRecord 记录某个充值周期内用户各档位的实际发放状态。
|
|
type RechargeRewardGrantRecord struct {
|
|
ID int64 `gorm:"column:id;primaryKey"`
|
|
ConfigID int64 `gorm:"column:config_id;index:idx_recharge_reward_grant_config_cycle,priority:1"`
|
|
LevelID int64 `gorm:"column:level_id"`
|
|
SysOrigin string `gorm:"column:sys_origin;size:32;uniqueIndex:uk_recharge_reward_grant_level,priority:1;index:idx_recharge_reward_grant_date,priority:1"`
|
|
CycleKey string `gorm:"column:cycle_key;size:32;uniqueIndex:uk_recharge_reward_grant_level,priority:2;index:idx_recharge_reward_grant_config_cycle,priority:2"`
|
|
RechargeDate int `gorm:"column:recharge_date;index:idx_recharge_reward_grant_user,priority:2;index:idx_recharge_reward_grant_date,priority:2"`
|
|
PeriodStartAt time.Time `gorm:"column:period_start_at"`
|
|
PeriodEndAt time.Time `gorm:"column:period_end_at"`
|
|
UserID int64 `gorm:"column:user_id;uniqueIndex:uk_recharge_reward_grant_level,priority:3;index:idx_recharge_reward_grant_user,priority:1"`
|
|
Account string `gorm:"column:account;size:64"`
|
|
UserAvatar string `gorm:"column:user_avatar;size:1024"`
|
|
UserNickname string `gorm:"column:user_nickname;size:255"`
|
|
CountryCode string `gorm:"column:country_code;size:32"`
|
|
CountryName string `gorm:"column:country_name;size:128"`
|
|
RechargeAmountCents int64 `gorm:"column:recharge_amount_cents"`
|
|
Level int `gorm:"column:level;uniqueIndex:uk_recharge_reward_grant_level,priority:4"`
|
|
RechargeThresholdCents int64 `gorm:"column:recharge_threshold_cents"`
|
|
RewardGold int64 `gorm:"column:reward_gold"`
|
|
RewardGroupID *int64 `gorm:"column:reward_group_id"`
|
|
RewardGroupName string `gorm:"column:reward_group_name;size:255"`
|
|
RewardGroupTrackID int64 `gorm:"column:reward_group_track_id"`
|
|
GoldEventID string `gorm:"column:gold_event_id;size:128;index:idx_recharge_reward_gold_event"`
|
|
Status string `gorm:"column:status;size:32;index:idx_recharge_reward_grant_config_cycle,priority:3;index:idx_recharge_reward_grant_date,priority:3"`
|
|
RewardGroupStatus string `gorm:"column:reward_group_status;size:32"`
|
|
RewardGoldStatus string `gorm:"column:reward_gold_status;size:32"`
|
|
RetryCount int `gorm:"column:retry_count"`
|
|
LastError string `gorm:"column:last_error;size:1024"`
|
|
SentAt *time.Time `gorm:"column:sent_at"`
|
|
CreateTime time.Time `gorm:"column:create_time"`
|
|
UpdateTime time.Time `gorm:"column:update_time"`
|
|
}
|
|
|
|
func (RechargeRewardGrantRecord) TableName() string { return "recharge_reward_grant_record" }
|