From 51c5c2f98f01b3f6dbb9f87ad6df859a0dc6a5a1 Mon Sep 17 00:00:00 2001 From: 王家文 Date: Fri, 19 Apr 2024 17:52:06 +0800 Subject: [PATCH] feat✨:星星商店配置类型更改 --- configs/confcardholder/config.go | 6 +++--- service/cardholder/handle.go | 10 +++++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/configs/confcardholder/config.go b/configs/confcardholder/config.go index 945308f..8f422c0 100644 --- a/configs/confcardholder/config.go +++ b/configs/confcardholder/config.go @@ -144,7 +144,7 @@ type CardSequenceConfig struct { // StarShopConfig 星星商店配置 type StarShopConfig struct { - Id int `json:"id"` // ID - NeedStarNumber int `json:"need_star_number"` // 需求星星数 - CardBagIds []int `json:"card_bag_ids"` // 可换取的卡包ID {卡包类型,卡包ID,卡包数量} + Id int `json:"id"` // ID + NeedStarNumber int `json:"need_star_number"` // 需求星星数 + CardBagIds string `json:"card_bag_ids"` // 可换取的卡包ID {卡包类型,卡包ID,卡包数量} } diff --git a/service/cardholder/handle.go b/service/cardholder/handle.go index a21d9c4..936aee5 100644 --- a/service/cardholder/handle.go +++ b/service/cardholder/handle.go @@ -7,7 +7,9 @@ import ( "apigame/util/util-lx/lxalilog" "apigame/util/util-lx/lxtime" "apigame/util/utslice" + "apigame/util/utstring" "strconv" + "strings" ) // HandleGetConfig 活动配置 @@ -179,13 +181,15 @@ func HandleShopExchange(req *models.ReqStarShopExchange) (code string, rsp model } // 判断配置 - if len(confStarShop.CardBagIds) < 3 { + cardBagIdsStr := strings.Split(confStarShop.CardBagIds, ",") + cardBagIds := utstring.ListStringToListInt(cardBagIdsStr) + if len(cardBagIds) < 3 { lxalilog.Errors("StarShopConfig.CardBagIds error", confStarShop.Id) code = code_msg.RECODE_MERGE_CONFIG_ERROR return } - cardholderId := confStarShop.CardBagIds[1] - cardholderCount := confStarShop.CardBagIds[2] + cardholderId := cardBagIds[1] + cardholderCount := cardBagIds[2] if cardholderCount < 1 { lxalilog.Errors("StarShopConfig.CardBagIds error", confStarShop.Id) code = code_msg.RECODE_MERGE_CONFIG_ERROR -- libgit2 0.21.0