Commit 51c5c2f98f01b3f6dbb9f87ad6df859a0dc6a5a1
1 parent
83ef3ff9
Exists in
master
and in
1 other branch
feat✨:星星商店配置类型更改
Showing
2 changed files
with
10 additions
and
6 deletions
Show diff stats
configs/confcardholder/config.go
| ... | ... | @@ -144,7 +144,7 @@ type CardSequenceConfig struct { |
| 144 | 144 | |
| 145 | 145 | // StarShopConfig 星星商店配置 |
| 146 | 146 | type StarShopConfig struct { |
| 147 | - Id int `json:"id"` // ID | |
| 148 | - NeedStarNumber int `json:"need_star_number"` // 需求星星数 | |
| 149 | - CardBagIds []int `json:"card_bag_ids"` // 可换取的卡包ID {卡包类型,卡包ID,卡包数量} | |
| 147 | + Id int `json:"id"` // ID | |
| 148 | + NeedStarNumber int `json:"need_star_number"` // 需求星星数 | |
| 149 | + CardBagIds string `json:"card_bag_ids"` // 可换取的卡包ID {卡包类型,卡包ID,卡包数量} | |
| 150 | 150 | } | ... | ... |
service/cardholder/handle.go
| ... | ... | @@ -7,7 +7,9 @@ import ( |
| 7 | 7 | "apigame/util/util-lx/lxalilog" |
| 8 | 8 | "apigame/util/util-lx/lxtime" |
| 9 | 9 | "apigame/util/utslice" |
| 10 | + "apigame/util/utstring" | |
| 10 | 11 | "strconv" |
| 12 | + "strings" | |
| 11 | 13 | ) |
| 12 | 14 | |
| 13 | 15 | // HandleGetConfig 活动配置 |
| ... | ... | @@ -179,13 +181,15 @@ func HandleShopExchange(req *models.ReqStarShopExchange) (code string, rsp model |
| 179 | 181 | } |
| 180 | 182 | |
| 181 | 183 | // 判断配置 |
| 182 | - if len(confStarShop.CardBagIds) < 3 { | |
| 184 | + cardBagIdsStr := strings.Split(confStarShop.CardBagIds, ",") | |
| 185 | + cardBagIds := utstring.ListStringToListInt(cardBagIdsStr) | |
| 186 | + if len(cardBagIds) < 3 { | |
| 183 | 187 | lxalilog.Errors("StarShopConfig.CardBagIds error", confStarShop.Id) |
| 184 | 188 | code = code_msg.RECODE_MERGE_CONFIG_ERROR |
| 185 | 189 | return |
| 186 | 190 | } |
| 187 | - cardholderId := confStarShop.CardBagIds[1] | |
| 188 | - cardholderCount := confStarShop.CardBagIds[2] | |
| 191 | + cardholderId := cardBagIds[1] | |
| 192 | + cardholderCount := cardBagIds[2] | |
| 189 | 193 | if cardholderCount < 1 { |
| 190 | 194 | lxalilog.Errors("StarShopConfig.CardBagIds error", confStarShop.Id) |
| 191 | 195 | code = code_msg.RECODE_MERGE_CONFIG_ERROR | ... | ... |