Commit ff742c87f6d61057fe7a43beffe4030938125df2

Authored by 王家文
1 parent a544e265
Exists in master and in 1 other branch dev-wjw

feat✨:星星商店配置

service/cardholder/config-client.go
@@ -7,4 +7,5 @@ type CardActivityConfigClient struct { @@ -7,4 +7,5 @@ type CardActivityConfigClient struct {
7 Albums []AlbumConfig `form:"albums" json:"albums"` // 卡组配置 7 Albums []AlbumConfig `form:"albums" json:"albums"` // 卡组配置
8 Cards []CardConfig `form:"cards" json:"cards"` // 卡牌配置 8 Cards []CardConfig `form:"cards" json:"cards"` // 卡牌配置
9 Holders []OpenCardholderConfig `form:"holders" json:"holders"` // 卡包开卡规则 9 Holders []OpenCardholderConfig `form:"holders" json:"holders"` // 卡包开卡规则
  10 + StarShop []StarShopConfig `form:"star_shop" json:"star_shop"` // 星星商店配置
10 } 11 }
service/cardholder/config-registry.go
@@ -33,6 +33,7 @@ func ConfigDecode(gameId string, configRaw *CardActivityConfigRaw) { @@ -33,6 +33,7 @@ func ConfigDecode(gameId string, configRaw *CardActivityConfigRaw) {
33 CardholderConfig: make(map[string]OpenCardholderConfig), 33 CardholderConfig: make(map[string]OpenCardholderConfig),
34 NormalCardStarConfig: make(map[string]NormalCardStarConfig), 34 NormalCardStarConfig: make(map[string]NormalCardStarConfig),
35 CardSequenceConfig: make(map[string]CardSequenceConfig), 35 CardSequenceConfig: make(map[string]CardSequenceConfig),
  36 + StarShopConfig: make(map[int]StarShopConfig),
36 } 37 }
37 // 解析奖励 38 // 解析奖励
38 { 39 {
@@ -106,6 +107,18 @@ func ConfigDecode(gameId string, configRaw *CardActivityConfigRaw) { @@ -106,6 +107,18 @@ func ConfigDecode(gameId string, configRaw *CardActivityConfigRaw) {
106 Config.CardSequenceConfig[combineId] = i2 107 Config.CardSequenceConfig[combineId] = i2
107 } 108 }
108 } 109 }
  110 + // 星星商店配置
  111 + {
  112 + configs := make([]StarShopConfig, 0)
  113 + err := json.Unmarshal([]byte(configRaw.StarShopConfig), &configs)
  114 + if err != nil {
  115 + lxalilog.Errors(err, configRaw.StarShopConfig, gameId, configRaw.Id)
  116 + return
  117 + }
  118 + for _, i2 := range configs {
  119 + Config.StarShopConfig[i2.Id] = i2
  120 + }
  121 + }
109 Configs[gameId] = Config 122 Configs[gameId] = Config
110 123
111 GenerateConfigClient(Config) 124 GenerateConfigClient(Config)
@@ -119,6 +132,7 @@ func GenerateConfigClient(config *CardActivityConfig) { @@ -119,6 +132,7 @@ func GenerateConfigClient(config *CardActivityConfig) {
119 Albums: make([]AlbumConfig, 0), 132 Albums: make([]AlbumConfig, 0),
120 Cards: make([]CardConfig, 0), 133 Cards: make([]CardConfig, 0),
121 Holders: make([]OpenCardholderConfig, 0), 134 Holders: make([]OpenCardholderConfig, 0),
  135 + StarShop: make([]StarShopConfig, 0),
122 } 136 }
123 for _, i2 := range config.AlbumConfig { 137 for _, i2 := range config.AlbumConfig {
124 configClient.Albums = append(configClient.Albums, i2) 138 configClient.Albums = append(configClient.Albums, i2)
@@ -129,6 +143,9 @@ func GenerateConfigClient(config *CardActivityConfig) { @@ -129,6 +143,9 @@ func GenerateConfigClient(config *CardActivityConfig) {
129 for _, i2 := range config.CardholderConfig { 143 for _, i2 := range config.CardholderConfig {
130 configClient.Holders = append(configClient.Holders, i2) 144 configClient.Holders = append(configClient.Holders, i2)
131 } 145 }
  146 + for _, i2 := range config.StarShopConfig {
  147 + configClient.StarShop = append(configClient.StarShop, i2)
  148 + }
132 config.Client = configClient 149 config.Client = configClient
133 } 150 }
134 151
service/cardholder/config.go
@@ -32,6 +32,7 @@ type CardActivityConfig struct { @@ -32,6 +32,7 @@ type CardActivityConfig struct {
32 CardholderConfig map[string]OpenCardholderConfig // 卡包开卡规则 32 CardholderConfig map[string]OpenCardholderConfig // 卡包开卡规则
33 NormalCardStarConfig map[string]NormalCardStarConfig // k=ID_用户序列_用户分组 卡片星级配置 33 NormalCardStarConfig map[string]NormalCardStarConfig // k=ID_用户序列_用户分组 卡片星级配置
34 CardSequenceConfig map[string]CardSequenceConfig // k=ID_用户序列_用户分组 卡片星级对应卡牌配置 34 CardSequenceConfig map[string]CardSequenceConfig // k=ID_用户序列_用户分组 卡片星级对应卡牌配置
  35 + StarShopConfig map[int]StarShopConfig // 星星商店配置
35 } 36 }
36 37
37 // CardActivityConfigRaw 卡牌活动配置 原始数据 38 // CardActivityConfigRaw 卡牌活动配置 原始数据
@@ -48,6 +49,7 @@ type CardActivityConfigRaw struct { @@ -48,6 +49,7 @@ type CardActivityConfigRaw struct {
48 CardHolderConfig string `json:"-"` // 卡包开卡规则 49 CardHolderConfig string `json:"-"` // 卡包开卡规则
49 NormalCardStarSequence string `json:"-"` // 卡片星级配置 50 NormalCardStarSequence string `json:"-"` // 卡片星级配置
50 CardSequenceConfig string `json:"-"` // 卡片星级对应卡牌配置 51 CardSequenceConfig string `json:"-"` // 卡片星级对应卡牌配置
  52 + StarShopConfig string `json:"-"` // 星星商店配置
51 Ver string // 版本号 53 Ver string // 版本号
52 Status int // 状态 0=关闭 1=开启 54 Status int // 状态 0=关闭 1=开启
53 UpdateTime int64 // 修改时间戳 55 UpdateTime int64 // 修改时间戳
@@ -104,9 +106,17 @@ type NormalCardStarConfig struct { @@ -104,9 +106,17 @@ type NormalCardStarConfig struct {
104 106
105 // CardSequenceConfig 星级ID对应的卡片 107 // CardSequenceConfig 星级ID对应的卡片
106 type CardSequenceConfig struct { 108 type CardSequenceConfig struct {
107 - Id string `json:"id"` // SequenceId 用户序列组ID 109 + Id string `json:"id"` // ID
108 SequenceId string `json:"user_sequence_id"` // 用户序列组ID 110 SequenceId string `json:"user_sequence_id"` // 用户序列组ID
109 Cohort string `json:"cohort"` // 用户分组 111 Cohort string `json:"cohort"` // 用户分组
110 CardIdList string `json:"card_id_list"` // 卡牌抽取序列 112 CardIdList string `json:"card_id_list"` // 卡牌抽取序列
111 CardIdLists []string `json:"-"` // 卡牌抽取序列 113 CardIdLists []string `json:"-"` // 卡牌抽取序列
112 } 114 }
  115 +
  116 +// StarShopConfig 星星商店配置
  117 +type StarShopConfig struct {
  118 + Id int `json:"id"` // ID
  119 + StarNumber int `json:"star_number"` // 需求星星数
  120 + CardholderId []int `json:"cardholder_id"` // 可换取的卡包ID // todo 要重命名
  121 + AlbumId int `json:"album_id"` // 对应卡册活动ID // todo 要重命名
  122 +}