Commit 5f9277c561e0d285704a10dc9729e36ddeb9bc88
1 parent
6321bf8d
Exists in
master
and in
1 other branch
feat✨:卡包卡牌活动配置接口
Showing
3 changed files
with
19 additions
and
10 deletions
Show diff stats
models/cardholder.go
| ... | ... | @@ -11,9 +11,10 @@ type ReqCardHolderGetConfig struct { |
| 11 | 11 | // RspCardHolderGetConfig 返回 活动配置 |
| 12 | 12 | type RspCardHolderGetConfig struct { |
| 13 | 13 | ActivityId int64 `form:"activity_id" json:"activity_id"` // 活动配置 0=无活动 |
| 14 | - PreviewTime int64 `form:"preview_time" json:"preview_time"` // 活动预告时间 | |
| 14 | + PrepareTime int64 `form:"prepare_time" json:"prepare_time"` // 活动预告时间 | |
| 15 | 15 | StartTime int64 `form:"start_time" json:"start_time"` // 活动开始时间 |
| 16 | 16 | EndTime int64 `form:"end_time" json:"end_time"` // 活动结束时间 |
| 17 | + Config any `form:"config" json:"config"` // 活动配置对象 | |
| 17 | 18 | } |
| 18 | 19 | |
| 19 | 20 | // CardHolderInfo 卡包信息 | ... | ... |
service/cardholder/config.go
| ... | ... | @@ -28,12 +28,12 @@ type CardActivityConfigRaw struct { |
| 28 | 28 | StartTime int64 // 开始时间 |
| 29 | 29 | EndTime int64 // 结束时间 |
| 30 | 30 | Round int // 轮数 |
| 31 | - Awards string // 奖励配置 | |
| 32 | - AlbumConfig string // 卡组配置 | |
| 33 | - CardConfig string // 卡牌配置 | |
| 34 | - CardHolderConfig string // 卡包开卡规则 | |
| 35 | - NormalCardStarSequence string // 卡片星级配置 | |
| 36 | - CardSequenceConfig string // 卡片星级对应卡牌配置 | |
| 31 | + Awards string `json:"-"` // 奖励配置 | |
| 32 | + AlbumConfig string `json:"-"` // 卡组配置 | |
| 33 | + CardConfig string `json:"-"` // 卡牌配置 | |
| 34 | + CardHolderConfig string `json:"-"` // 卡包开卡规则 | |
| 35 | + NormalCardStarSequence string `json:"-"` // 卡片星级配置 | |
| 36 | + CardSequenceConfig string `json:"-"` // 卡片星级对应卡牌配置 | |
| 37 | 37 | Ver string // 版本号 |
| 38 | 38 | Status int // 状态 0=关闭 1=开启 |
| 39 | 39 | UpdateTime int64 // 修改时间戳 |
| ... | ... | @@ -41,7 +41,9 @@ type CardActivityConfigRaw struct { |
| 41 | 41 | |
| 42 | 42 | // AlbumConfig 卡组表 |
| 43 | 43 | type AlbumConfig struct { |
| 44 | - SetId string `json:"set_id"` // 卡组id | |
| 44 | + SetId string `json:"set_id"` // 卡组名 | |
| 45 | + Name string `json:"name"` // 卡组图片 | |
| 46 | + Icon string `json:"icon"` // 卡组id | |
| 45 | 47 | Rewards map[string]string `json:"rewards"` // 集齐奖励 k=轮次 |
| 46 | 48 | StartTime int64 `json:"start_time"` // 开始时间 |
| 47 | 49 | EndTime int64 `json:"end_time"` // 结束时间 |
| ... | ... | @@ -50,9 +52,13 @@ type AlbumConfig struct { |
| 50 | 52 | // CardConfig 卡牌表 |
| 51 | 53 | type CardConfig struct { |
| 52 | 54 | Id int `json:"id"` // ID |
| 55 | + Name string `json:"name"` // 卡牌图片 | |
| 56 | + Icon string `json:"icon"` // 卡牌id | |
| 57 | + Desc string `json:"desc"` // 卡牌描述 | |
| 53 | 58 | SetId string `json:"album_setid"` // 卡组id |
| 54 | - IsGold int `json:"is_gold"` // 是否是金卡 | |
| 55 | 59 | Star int `json:"star"` // 星级 |
| 60 | + IsGold int `json:"is_gold"` // 是否是金卡 | |
| 61 | + IsSend int `json:"is_send"` // 卡片是否可赠送 | |
| 56 | 62 | } |
| 57 | 63 | |
| 58 | 64 | // OpenCardholderConfig 卡包开卡规则表 | ... | ... |
service/cardholder/handle.go
| ... | ... | @@ -19,10 +19,12 @@ func HandleGetConfig(req *models.ReqCardHolderGetConfig) (code string, rsp model |
| 19 | 19 | // 尝试更新配置 |
| 20 | 20 | config, _ := TryUpdateConfig(req.GameID) |
| 21 | 21 | rsp.ActivityId = config.Id |
| 22 | - rsp.PreviewTime = config.Raw.PreviewTime | |
| 22 | + rsp.PrepareTime = config.Raw.PreviewTime | |
| 23 | 23 | rsp.StartTime = config.Raw.StartTime |
| 24 | 24 | rsp.EndTime = config.Raw.EndTime |
| 25 | 25 | |
| 26 | + rsp.Config = config | |
| 27 | + | |
| 26 | 28 | return |
| 27 | 29 | } |
| 28 | 30 | ... | ... |