You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
3.8 KiB
61 lines
3.8 KiB
package common |
|
|
|
type RankAward struct { |
|
SmallRank int `json:"sr"` // 最小排名 |
|
LargeRank int `json:"lr"` // 最大排名 |
|
AwardRate int `json:"ar"` // 奖励比例(*100) |
|
} |
|
|
|
/* |
|
天:1,周:2,月:3 |
|
RankCycle --> {"1":{},"2":{},"3":{}} 表示配置了天,周,月排行榜 |
|
RankAwards --> {"1":$RankAwards}, $RankAwards为[]RankAward的json格式 |
|
FreeRates --> {"1":100,"2":100,"3":100} 表示天,周,月的抽水比例都为1(*10000) |
|
RobotRank --> "1-10,12,13" 表示1~10,12,13名 |
|
*/ |
|
// ConfigRank 排行榜配置 |
|
type ConfigRank struct { |
|
ID int `gorm:"primarykey"` |
|
Open int `gorm:"column:open;type:int(11);default:1;comment:是否开启 1开2不开" web:"open"` |
|
RankType int `gorm:"column:rank_type;not null;type:int(11);comment:排行榜类型(1:打码,2:充值)" web:"rank_type"` |
|
JoinType int `gorm:"column:join_type;not null;type:int(11);comment:参加类型(1:自动参加)" web:"join_type"` |
|
RankCycle string `gorm:"column:rank_cycle;type:varchar(255);comment:排行榜周期" web:"rank_cycle"` |
|
RankAwards string `gorm:"column:rank_awards;type:text;comment:排行榜奖励信息" web:"rank_awards"` |
|
FreeRates string `gorm:"column:free_rates;type:varchar(255);comment:抽水比例" web:"free_rates"` |
|
RobotRank string `gorm:"column:robot_rank;type:varchar(255);comment:机器人排名信息" web:"robot_rank"` |
|
UpdatedBase |
|
|
|
RankCycleMap map[string]struct{} `gorm:"-"` |
|
FreeRatesMap map[string]int `gorm:"-"` |
|
RobotRankMap map[int]struct{} `gorm:"-"` |
|
RankAwardsMap map[string][]RankAward `gorm:"-"` |
|
} |
|
|
|
func (c *ConfigRank) TableName() string { |
|
return "config_rank" |
|
} |
|
|
|
type RankData struct { |
|
ID int64 `gorm:"column:id;type:bigint(20);primaryKey;autoIncrement:true" json:"id"` |
|
UID int `gorm:"column:uid;type:bigint(11);not null;uniqueIndex:rank_idx,priority:4;comment:玩家id" json:"uid"` // 玩家id |
|
RankType int `gorm:"column:rank_type;type:int(11);not null;uniqueIndex:rank_idx,priority:1;comment:排行榜类型(1:打码,2:充值)" json:"rank_type"` // 排行榜类型(1:打码,2:充值) |
|
RankCycle int `gorm:"column:rank_cycle;type:int(11);not null;uniqueIndex:rank_idx,priority:2;comment:排行榜周期(1:日,2:周,3:月)" json:"rank_cycle"` // 排行榜周期(1:日,2:周,3:月) |
|
RankAt int64 `gorm:"column:rank_at;type:bigint(20);not null;uniqueIndex:rank_idx,priority:3;comment:排行榜开始日期" json:"rank_at"` // 排行榜开始日期 |
|
RankValue int64 `gorm:"column:rank_value;type:bigint(20);not null;comment:玩家数值" json:"rank_value"` // 玩家数值 |
|
IsRobot int `gorm:"column:is_robot;type:int(11);not null;comment:是不是机器人(0:不是,1:是)" json:"is_robot"` // 是不是机器人(0:不是,1:是) |
|
UserAward int `gorm:"column:user_award;type:int(11);not null;comment:玩家奖励比例(*10000)" json:"user_award"` // 玩家奖励比例(*10000) |
|
UserAwardCount int64 `gorm:"column:user_award_count;type:bigint(20);not null;comment:玩家奖励数量" json:"user_award_count"` // 玩家奖励数量 |
|
Rank int `gorm:"column:rank;type:int(11);default:0;comment:排名" json:"rank"` // 玩家奖励比例(*10000) |
|
UpdatedAt int64 `gorm:"column:updated_at;type:bigint(20);not null;comment:更新时间" json:"updated_at"` // 更新时间 |
|
|
|
UserInfo PlayerDBInfo `gorm:"-"` |
|
} |
|
|
|
type RankDataWithUser struct { |
|
RankData `gorm:"embedded"` // RankData的所有字段会展开到表中 |
|
UserInfo PlayerDBInfo `gorm:"embedded"` // UserInfo的所有字段也会展开到同一张表中 |
|
} |
|
|
|
func (c *RankData) TableName() string { |
|
return "rank_data" |
|
}
|
|
|