礼包添加前置显示条件

(cherry picked from commit 7fa6820a1e)
PC-202302260912\Administrator 2023-11-30 18:57:26 +08:00 committed by wangzhenxing
parent 84f67cdfca
commit cfc913bbc7
1 changed files with 38 additions and 4 deletions

View File

@ -7,7 +7,7 @@
--]]
require("Modules.Operating.MonthCardManager")
require("Modules.Operating.WeekCardManager")
local rechargeOrder=ConfigManager.GetConfig(ConfigName.RechargeCommodityorder)
OperatingManager = {}
local this = OperatingManager
--后端数据 以RechargeCommodityConfig表Type为键
@ -52,7 +52,8 @@ function this.SetBasicValues(giftGoodsList)
.."次 开始时间:"..tostring(giftGoodsInfo.startTime).." 结束时间:"..tostring(giftGoodsInfo.endTime).. " 可购:" ..tostring(giftGoodsInfo.dynamicBuyTimes).." 是否已买:"..tostring(giftGoodsInfo.isBought))
if giftGoodsInfo.endTime == 0 and giftGoodsInfo.startTime == 0 and (rechargeConfigLocal.ShowType == 25 or rechargeConfigLocal.ShowType == 26 or rechargeConfigLocal.ShowType == 8 ) then
elseif rechargeConfigLocal.Package == 2 and AppConst.SdkChannel=="XQDC" then
-- elseif this.CheckGiftFrontIsOpen(giftGoodsInfo.goodsId)==false then
-- LogError("前置条件不满足================")
else
if giftGoodsInfoList[rechargeConfigLocal.Type] then
table.insert(giftGoodsInfoList[rechargeConfigLocal.Type], giftGoodsInfo)
@ -63,9 +64,42 @@ function this.SetBasicValues(giftGoodsList)
end
end
end
--屏蔽前置礼包没有达成购买限制的
for _, v in pairs(GoodsTypeDef) do
for key, value in pairs(giftGoodsInfoList[v]) do
if this.CheckGiftFrontIsOpen(value.goodsId)==false then
table.remove(giftGoodsInfoList[v], key)
end
end
end
--this.RemoveItemInfoByType
Game.GlobalEvent:DispatchEvent(GameEvent.FindFairy.RefreshBuyOpenState)
end
--检测礼包前置是否开启
function this.CheckGiftFrontIsOpen(gift)
local isOpen=true
for k, v in ConfigPairs(rechargeOrder) do
if v.BehindCommodity==gift then
if v.FrontCommodity>0 then
local time=this.GetLeftBuyTime(rechargeConfig[v.FrontCommodity].Type, v.FrontCommodity)
local buyTime= this.GetGoodsBuyTime(rechargeConfig[v.FrontCommodity].Type, v.FrontCommodity)
--无限次
if time==-1 then
return true
end
LogError("time================="..time.." v.FrontCommodityNumber==========="..v.FrontCommodityNumber.." buyTime=="..buyTime.."   "..gift)
if time>v.FrontCommodityNumber then
return false
end
end
end
end
return isOpen
end
--判断商品是否可购买(成长礼)
function this.IsGrowthGiftGoodsAvailable(goodsType)
for _, v in ipairs(giftGoodsInfo)do