local ShopData = class("ShopData", BaseData) function ShopData:ctor() self.data.isDirty = false end function ShopData:initBase() self:initActChapterStoreData() self:initFirstRecharge() self:initCrossDay() end function ShopData:clear() DataManager:unregisterCrossDayFunc("ShopData") end function ShopData:setDirty() self.data.isDirty = not self.data.isDirty end function ShopData:initCrossDay() DataManager:registerCrossDayFunc("ShopData", function() self:resetMallDaily() self:resetCommonDailyGemAdCount() self:resetCommonDailyCoinAdCount() self:setDirty() end) end -- 通用礼包部分 ********************************************************************************************** -- 初始化购买的礼包 function ShopData:initActGift(act) if EDITOR_MODE then Logger.logHighlight("初始化 initActGift") Logger.printTable(act) end act = act or {} local gifts = act.gifts or {} -- 转为map结构 for _, gift in ipairs(gifts) do local giftType = gift.act_type local giftId = gift.id local buyCount = gift.buy_count -- 已购次数 local latestBuyTime = gift.latest_buy_at -- 最后一次购买时间 local latestOrderUuid = gift.latest_order_uuid -- 正在支付的订单ID if not self.giftMap then self.giftMap = {} end if not self.giftMap[giftType] then self.giftMap[giftType] = {} end self.giftMap[giftType][giftId] = gift end self:setDirty() end function ShopData:getActGiftConfig() return ConfigManager:getConfig("act_gift") end -- 已购买的礼包 function ShopData:getActGiftMap() return self.giftMap end function ShopData:getActGiftMapByType(actType) return self.giftMap and self.giftMap[actType] end function ShopData:getActGiftDetailData(actType, actId) if self.giftMap then if self.giftMap[actType] then return self.giftMap[actType][actId] end end return nil end -- 获得一个礼包的已购次数 function ShopData:getGiftBoughtNum(actType, actId) local data = self:getActGiftDetailData(actType, actId) if data then return data.buy_count end return 0 end function ShopData:updateGiftInfo(gift) local giftType = gift.act_type local giftId = gift.id if not self.giftMap then self.giftMap = {} end if not self.giftMap[giftType] then self.giftMap[giftType] = {} end self.giftMap[giftType][giftId] = gift if giftType == PayManager.PURCHARSE_TYPE.ACT_GIFT then local cfgName = PayManager.PURCHARSE_TYPE_CONFIG[giftType] if cfgName then local cfg = ConfigManager:getConfig(cfgName) if cfg and cfg[giftId] and cfg[giftId].type == PayManager.PURCHARSE_ACT_TYPE.GROWTH_FUND then DataManager.GrowthFundData:onBoughtFund(giftId) end end end self:setDirty() end -- 标记一个礼包需要弹出 在条件允许时会弹出 function ShopData:markPopUpGift(actType, actId) if not self.needPopUpGift then self.needPopUpGift = {} end if not self.needPopUpGift[actType] then self.needPopUpGift[actType] = {} end table.insert(self.needPopUpGift[actType], actId) table.sort(self.needPopUpGift[actType]) end function ShopData:removePopUpGift(actType, actId) if self.needPopUpGift then if self.needPopUpGift[actType] then for index, id in ipairs(self.needPopUpGift[actType]) do if id == actId then table.remove(self.needPopUpGift[actType], index) break end end end end end -- 获取待处理弹出礼包结构 {type:[id1,id2,...]} function ShopData:getPopUpGift() return self.needPopUpGift end function ShopData:getPopUpGiftByType(actType) return self.needPopUpGift and self.needPopUpGift[actType] end -- 获取下一个需要弹出的同类型礼包数据,特别的,如果是主界面部分则多个不同类型的也要考虑进去 function ShopData:getNextPopGiftData(actType, actId) if GConst.ShopConst.MAIN_UI_POP_TYPE[actType] then -- 优先找自己类型的,如果是act类则需要找同类型的 local popUpGift = self:getPopUpGiftByType(actType) if popUpGift and #popUpGift > 0 then if actType == PayManager.PURCHARSE_TYPE.ACT_GIFT then for _, nextActId in ipairs(popUpGift) do if self:getActGiftConfig()[nextActId].type == self:getActGiftConfig()[actId].type then return actType, nextActId end end else for _, nextActId in ipairs(popUpGift) do return actType, nextActId end end end -- 按顺序找其他类型的 if actType ~= PayManager.PURCHARSE_TYPE.ACT_GIFT then local popUpGift = self:getPopUpGiftByType(PayManager.PURCHARSE_TYPE.ACT_GIFT) if popUpGift and #popUpGift > 0 then for _, nextActId in ipairs(popUpGift) do -- 新手礼包 if self:getActGiftConfig()[nextActId].type == PayManager.PURCHARSE_ACT_TYPE.BEGINNER_GIFT then return PayManager.PURCHARSE_TYPE.ACT_GIFT, nextActId end -- 助力礼包 if self:getActGiftConfig()[nextActId].type == PayManager.PURCHARSE_ACT_TYPE.LEVEL_UP_GIFT then return PayManager.PURCHARSE_TYPE.ACT_GIFT, nextActId end end end end if actType ~= PayManager.PURCHARSE_TYPE.CHAPTER_GIFT then local popUpGift = self:getPopUpGiftByType(PayManager.PURCHARSE_TYPE.CHAPTER_GIFT) if popUpGift and #popUpGift > 0 then for _, nextActId in ipairs(popUpGift) do return PayManager.PURCHARSE_TYPE.CHAPTER_GIFT, nextActId end end end else -- 直接返回同类型的即可 local popUpGift = self:getPopUpGiftByType(actType) if popUpGift and #popUpGift > 0 then for _, nextActId in ipairs(popUpGift) do return actType, nextActId end end end return nil end -- 通用礼包结束 ---------------------------------------------------------------------------------------------- -- 每日特惠部分 ********************************************************************************************** function ShopData:getMallDailyConfig() return ConfigManager:getConfig("mall_daily") end -- 初始化每日特惠 function ShopData:initMallDaily(mallDaily) -- if EDITOR_MODE then -- Logger.logHighlight("初始化 initMallDaily") -- Logger.printTable(mallDaily) -- end mallDaily = mallDaily or {} self.mallDailyAdResetCount = mallDaily.ad_reset_Count or 0 self.mallDailyDiamondResetCount = mallDaily.diamond_reset_Count or 0 self.mallDailyGoods = mallDaily.goods or {} -- {id,good_index,bought} self:markMallDailyDirty(false) self:setDirty() end -- 购买成功后更新数据 function ShopData:updateMallDailyGoods(info) local goods = self:getMallDailyGoods() for _, data in ipairs(goods) do if data.id == info.id and data.good_index == info.good_index then data.bought = info.bought break end end self:setDirty() end -- 每日特惠跨天重置 function ShopData:resetMallDaily() self.mallDailyAdResetCount = 0 self.mallDailyDiamondResetCount = 0 self:markMallDailyDirty(true) -- 标记需要重新请求数据,在界面/下次打开界面时请求 end function ShopData:getMallDailyDirty() return self.data.mallDailyDirty end function ShopData:markMallDailyDirty(isDirty) self.data.mallDailyDirty = isDirty end function ShopData:getMallDailyAdResetCount() return self.mallDailyAdResetCount end function ShopData:addMallDailyAdResetCount() self.mallDailyAdResetCount = self.mallDailyAdResetCount + 1 end function ShopData:getMallDailyAdLeftCount() return 1 - self.mallDailyAdResetCount -- 目前无配置表 end function ShopData:getMallDailyDiamondResetCount() return self.mallDailyDiamondResetCount end function ShopData:addMallDailyDiamondResetCount() self.mallDailyDiamondResetCount = self.mallDailyDiamondResetCount + 1 end function ShopData:getMallDailyDiamondLeftCount() return 1 - self.mallDailyDiamondResetCount -- 目前无配置表 end function ShopData:getMallDailyGoods() return self.mallDailyGoods end function ShopData:getMallDailyDiamondResetCost() return 30 -- 目前无配置表 end -- 每日特惠 广告商品最大购买次数 function ShopData:getMallDailyFirstItemAdMaxCount() return 1 -- 目前无配置表 end -- 每日特惠 常规商品最大购买次数 function ShopData:getMallDailyGoodsLimitCount() return 1 -- 目前无配置表 end -- 每日特惠 是否开启 function ShopData:getMallDailyIsOpen() return ModuleManager:getIsOpen() end -- 根据商品id获取本日的随机商品数据 function ShopData:getMallDailyRewardAndCost(id) local cfg = self:getMallDailyConfig() local index for _, info in ipairs(self:getMallDailyGoods()) do if info.id == id then index = info.good_index break end end if index then return cfg[id].good[index], cfg[id].cost and cfg[id].cost[index] end end -- 每日特惠结束 ---------------------------------------------------------------------------------------------- -- 常驻金币礼包 ********************************************************************************************** function ShopData:getMallGoldConfig() return ConfigManager:getConfig("mall_gold") end function ShopData:initCommonDailyGoldGift(ad_count) -- if EDITOR_MODE then -- Logger.logHighlight("初始化 initCommonDailyGoldGift") -- Logger.printTable(ad_count) -- end ad_count = ad_count or {} self.commonDailyGoldBuyCount = ad_count[1] or 0 -- 已购的金币广告礼包次数 self:setDirty() end function ShopData:getCommonDailyCoinAdBuyCount() return self.commonDailyGoldBuyCount end function ShopData:resetCommonDailyCoinAdCount() self.commonDailyGoldBuyCount = 0 end -- 根据时间得到当前挂机金币奖励 function ShopData:getCommonDailyCoinNum(id) local cfgInfo = self:getMallGoldConfig()[id] if cfgInfo then return cfgInfo.gold.num end end function ShopData:getCommonDailyCoinDataById(id) local cfgInfo = self:getMallGoldConfig()[id] if cfgInfo then return cfgInfo.gold.num, cfgInfo.cost end end -- 常驻金币礼包结束 ---------------------------------------------------------------------------------------------- -- 常驻钻石礼包 ********************************************************************************************** function ShopData:resetCommonDailyGemAdCount() local gift = self:getActGiftDetailData(PayManager.PURCHARSE_TYPE.MALL_TREASURE, 1) if gift then gift.buy_count = 0 end end function ShopData:getMallTreasureConfig() return ConfigManager:getConfig("mall_treasure") -- 审核模式会去读另一张表,在config_manager中处理的 end -- 常驻钻石礼包结束 ---------------------------------------------------------------------------------------------- -- 章节礼包 act_chapter_store ********************************************************************************************** function ShopData:initActChapterStoreData() if not self.actChapterStoreMap then self.actChapterStoreId2ChapterIdMap = {} self.actChapterStoreChapterId2IdMap = {} local cfg = self:getActChapterStoreConfig() for id, cfgInfo in pairs(cfg) do self.actChapterStoreId2ChapterIdMap[id] = cfgInfo.chapter self.actChapterStoreChapterId2IdMap[cfgInfo.chapter] = id end end end function ShopData:getActChapterStoreConfig() return ConfigManager:getConfig("act_chapter_store") end -- 特定章节礼包是否已购买 function ShopData:getActChapterStoreHasBuy(chapterId) -- 章节礼包的id-chapterId相互对应map local actId = self.actChapterStoreChapterId2IdMap[chapterId] if self:getGiftBoughtNum(PayManager.PURCHARSE_TYPE.CHAPTER_GIFT, actId) == 0 then return false else return true end end -- 根据当前章节,获取可购买的id数组 function ShopData:getActChapterStoreCanBuyActIds() local list = {} local curChapterId = DataManager.ChapterData:getMaxChapterId() for id = 1, curChapterId do if not self:getActChapterStoreHasBuy(id) then table.insert(list, self.actChapterStoreChapterId2IdMap[id]) end end return list end function ShopData:markPopUpGiftForActChapterStore(chapterId) local actId = self.actChapterStoreChapterId2IdMap[chapterId] self:markPopUpGift(PayManager.PURCHARSE_TYPE.CHAPTER_GIFT, actId) end -- 章节礼包结束 ---------------------------------------------------------------------------------------------- -- 新手礼包 ********************************************************************************************** function ShopData:getIsBeginnerGiftOpen() return ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.BEGINNER_GIFT, true) end function ShopData:markPopUpGiftForBeginnerGift() self:markPopUpGift(PayManager.PURCHARSE_TYPE.ACT_GIFT, GConst.ShopConst.BEGINNER_GIFT_ID) end function ShopData:getBeginnerGiftHasBuy() if self:getGiftBoughtNum(PayManager.PURCHARSE_TYPE.ACT_GIFT, GConst.ShopConst.BEGINNER_GIFT_ID) == 0 then return false else return true end end -- 新手礼包侧边栏展示时间 function ShopData:getBeginnerGiftSideBarDurationTime() return 3 * 24 * 3600 -- 目前无配置表 end -- 已开启 未购买 且 在开服的3天内 function ShopData:getBeginnerGiftShowSideBar() return self:getIsBeginnerGiftOpen() and not self:getBeginnerGiftHasBuy() and self:getBeginnerGiftSideBarRemainTime() > 0 end -- 展示在侧边栏的剩余时间 function ShopData:getBeginnerGiftSideBarRemainTime() local createTime = DataManager.PlayerData:getCreateTime() // 1000 local durationTime = self:getBeginnerGiftSideBarDurationTime() return createTime + durationTime - Time:getServerTime() end -- 新手礼包结束 ---------------------------------------------------------------------------------------------- -- 助力与金币礼包(act_gift) ********************************************************************************************** -- 初始化助力与金币礼包 function ShopData:initLevelUpGift(levelUpGift) -- if EDITOR_MODE then -- Logger.logHighlight("初始化 助力与金币礼包") -- Logger.printTable(levelUpGift) -- end levelUpGift = levelUpGift or {} self.levelUpGifts = levelUpGift.gifts or {} -- [{trigger_level,current_level_up_gift,trigger_at}] -- 金币礼包部分会一直保留 self:initCoinGift(levelUpGift.gold_gift_id, levelUpGift.gold_gift_trigger_at) self.data.currentPayAmount = levelUpGift.current_pay_amount or 0 -- 已经计算过降档的付费数额 self:setDirty() end function ShopData:initCoinGift(id, triggerTime) -- if EDITOR_MODE then -- Logger.logHighlight("初始化 金币礼包 -- id:%s time:%s", id, triggerTime) -- end self.coinGiftId = id or 0 -- 金币礼包触发id self.coinGiftTriggerTime = triggerTime or 0 -- 金币礼包触发时间 self:setDirty() end function ShopData:getPayAmount() return self.data.currentPayAmount end function ShopData:addPayment(rechargeId) local cfg = ConfigManager:getConfig("recharge")[rechargeId] self.data.currentPayAmount = self.data.currentPayAmount + cfg.price end function ShopData:getLevelUpGift() return self.levelUpGifts end function ShopData:onTriggerLevelUpGift(gift) table.insert(self.levelUpGifts, gift) -- 标记弹窗 self:markPopUpGift(PayManager.PURCHARSE_TYPE.ACT_GIFT, gift.current_level_up_gift) end function ShopData:removeLevelUpGift(actId) for index, gift in ipairs(self.levelUpGifts) do if gift.current_level_up_gift == actId then table.remove(self.levelUpGifts, index) break end end end -- 获得可购买的助力礼包Ids function ShopData:getLevelUpGiftActIds() local list = {} for index, gift in ipairs(self.levelUpGifts) do -- 剔除已购的助力礼包 这个礼包只会有一次 if self:getGiftBoughtNum(PayManager.PURCHARSE_TYPE.ACT_GIFT, gift.current_level_up_gift) == 0 then table.insert(list, gift.current_level_up_gift) end end table.sort(list) return list end -- 获得当前金币礼包的id function ShopData:getCoinGiftId() return self.coinGiftId end -- 获得金币礼包的触发时间 function ShopData:getCoinGiftTriggerTime() return self.coinGiftTriggerTime // 1000 end -- 获得当前可购买的金币礼包id,需要未购买且时间满足 function ShopData:getValidCoinGiftId() local actId = self:getCoinGiftId() if actId > 0 then local cfgInfo = self:getActGiftConfig()[actId] local triggerTime = self:getCoinGiftTriggerTime() local remainTime = triggerTime + (cfgInfo.limit_time or 0) * 3600 - Time:getServerTime() if remainTime > 0 then -- 查看最近一次购买时间 local actGiftDetailData = self:getActGiftDetailData(PayManager.PURCHARSE_TYPE.ACT_GIFT, actId) if actGiftDetailData then local latestBuyTime = actGiftDetailData.latest_buy_at // 1000 if latestBuyTime <= 0 then return actId else -- 目前规则上有CD 所以如果购买时间在CD范围内则该礼包无效 local limitTime = (self:getActGiftConfig()[actId].limit_time or 0) * 3600 if Time:getServerTime() > latestBuyTime + limitTime then return actId end end else -- 没有买过,这个肯定可以购买 return actId end end end return nil end -- 获取金币礼包付款条件cfgInfo数组 从小到大 function ShopData:_getCoinGiftPayConditionList() if not self.coinGiftPayConditionList then self.coinGiftPayConditionList = {} for id, cfgInfo in pairs(self:getActGiftConfig()) do if cfgInfo.type == PayManager.PURCHARSE_ACT_TYPE.COIN_GIFT then local tmpCfgInfo = clone(cfgInfo) tmpCfgInfo.id = id table.insert(self.coinGiftPayConditionList, tmpCfgInfo) end end table.sort(self.coinGiftPayConditionList, function (a, b) return a.pay_condition[1] < b.pay_condition[1] end) end return self.coinGiftPayConditionList end -- 根据当前付费和金币礼包数据 判断并返回合法的金币礼包触发id function ShopData:checkAndGetCoinGiftTriggerId() local triggerId local canTrigger = true local curActId = self:getCoinGiftId() if curActId > 0 then local cfgInfo = self:getActGiftConfig()[curActId] local cdTime = (cfgInfo.cd or 0) * 3600 local curTriggerTime = self:getCoinGiftTriggerTime() -- 是否还在已触发限时内 if Time:getServerTime() < curTriggerTime + cdTime then canTrigger = false end end if canTrigger then -- 从表中找出符合付费金额的actId local payAmount = self:getPayAmount() local payConditionList = self:_getCoinGiftPayConditionList() for index, info in ipairs(payConditionList) do local p1 = info.pay_condition[1] local p2 = info.pay_condition[2] if p1 <= payAmount and payAmount < p2 then triggerId = info.id break end end -- 超出上限 if not triggerId then local count = #payConditionList triggerId = payConditionList[count].id end end return triggerId end function ShopData:onTriggerCoinGift(actId) self:initCoinGift(actId, Time:getServerTime() * 1000) -- 标记弹窗 self:markPopUpGift(PayManager.PURCHARSE_TYPE.ACT_GIFT, actId) end -- 助力礼包结束 ---------------------------------------------------------------------------------------------- -- 成长礼包 ********************************************************************************************** function ShopData:getActGrowUpGiftConfig() return ConfigManager:getConfig("act_growup_gift") end -- 初始化成长礼包 function ShopData:initGrowUpGift(growUpGift, loginTime) if EDITOR_MODE then Logger.logHighlight("初始化成长礼包 growUpGift -- now_ts:%s", loginTime) Logger.printTable(growUpGift) end growUpGift = growUpGift or {} self.growUpGifts = growUpGift.grow_up_gift or {} -- {hero_id, current_grow_up_id, trigger_at} for _, gift in ipairs(self.growUpGifts) do -- 标记需要弹出的礼包 if gift.trigger_at == loginTime then self:markPopUpGiftForGrowUpGift(gift.current_grow_up_id) end end self:setDirty() end function ShopData:getGrowUpGifts() return self.growUpGifts end -- 目前允许显示的最多2个礼包 function ShopData:getMaxGrowUpGiftCount() return 2 end function ShopData:getGrowUpGiftByActId(actId) local list = self:getGrowUpGifts() for _, gift in ipairs(list) do if gift.current_grow_up_id == actId then return gift end end end -- 获取目前时间有效的成长礼包 function ShopData:getValidGrowUpGifts() local list = {} for index, gift in ipairs(self:getGrowUpGifts()) do local cfgInfo = self:getActGrowUpGiftConfig()[gift.current_grow_up_id] if cfgInfo then local isValid = false local durationTime = (cfgInfo.limit_time or 0) * 3600 local triggerTime = gift.trigger_at // 1000 local maxDurationTime = triggerTime + durationTime local buyLimit = cfgInfo.limit or 0 -- 是否在有效范围内 local isInDurationTime = Time:getServerTime() < maxDurationTime if isInDurationTime then -- 如果是最后一档 默认有效 if cfgInfo.last then isValid = true else -- 否则从通用act里找到这个礼包 如果有该礼包且购买次数未达到上限,则有效;如果没有该礼包也有效 local actGiftDetailData = self:getActGiftDetailData(PayManager.PURCHARSE_TYPE.GROW_UP_GIFT, gift.current_grow_up_id) if actGiftDetailData then local buyCount = actGiftDetailData.buy_count local latestBuyTime = actGiftDetailData.latest_buy_at // 1000 if buyLimit > 0 then if buyCount < buyLimit then isValid = true end else isValid = true end else isValid = true end end end if isValid then table.insert(list, gift) end end end -- 按照时间排序 table.sort(list, function(a, b) return a.trigger_at < b.trigger_at end) -- 上限2位 local limitList = {} for i = 1, self:getMaxGrowUpGiftCount() do if list[i] then table.insert(limitList, list[i]) end end return limitList end -- 触发了成长礼包 function ShopData:onTriggerGrowUpGift(gift) local hasGift = false if self.growUpGifts then for _, ownGift in ipairs(self.growUpGifts) do if ownGift.current_grow_up_id == gift.current_grow_up_id then ownGift.trigger_at = gift.trigger_at ownGift.hero_id = gift.hero_id hasGift = true break end end end if not hasGift then table.insert(self.growUpGifts, gift) end self:setDirty() end function ShopData:markPopUpGiftForGrowUpGift(actId) self:markPopUpGift(PayManager.PURCHARSE_TYPE.GROW_UP_GIFT, actId) end -- 成长礼包结束 ---------------------------------------------------------------------------------------------- -- 首充 ********************************************************************************************** function ShopData:getIsFirstRechargeOpen() return ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.FIRST_RECHARGE, true) end -- 用于标记是否弹窗 要求等级不低于2 未领取该奖励 function ShopData:initFirstRecharge() local lv = DataManager.PlayerData:getLv() if lv > 1 and not self:getHasGotFirstRechargeReward() then self:markPopUpGift(PayManager.PURCHARSE_TYPE.ACT_GIFT, GConst.ShopConst.FIRST_RECHARGE_ID) end end -- 是否有首充奖励 有支付且未领取 function ShopData:getHasFirstRechargeReward() local pay = DataManager.PlayerData:getTotalPayAmount() if pay > 0 and not self:getHasGotFirstRechargeReward() then return true else return false end end -- 是否已领取首充奖励 function ShopData:getHasGotFirstRechargeReward() -- 通用act礼包中是否有已购 local boughtNum = self:getGiftBoughtNum(PayManager.PURCHARSE_TYPE.ACT_GIFT, GConst.ShopConst.FIRST_RECHARGE_ID) return boughtNum > 0 end -- 侧边栏是否展示 要求功能开启 未领取该奖励 function ShopData:getShowFirstRechargeSideBar() if not self:getIsFirstRechargeOpen() then return false end if not self:getHasGotFirstRechargeReward() then return true else return false end end -- 侧边栏红点 function ShopData:showFirstRechargeRp() if not self:getIsFirstRechargeOpen() then return false end return self:getHasFirstRechargeReward() end -- 首充结束 ---------------------------------------------------------------------------------------------- -- 底部栏是否有红点 function ShopData:getRp() if not ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.MALL, true) then return false end local isHotOpen = ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.MALL_DAILY, true) -- 主要商品 每日特惠广告道具 local hotAdGoods = self:getMallDailyGoods() and self:getMallDailyGoods()[1] local hotAdGoodsBuyCount = hotAdGoods and hotAdGoods.bought or 0 local hotAdGoodsRp = self:getMallDailyFirstItemAdMaxCount() - hotAdGoodsBuyCount > 0 -- 主要商品 每日特惠刷新 local hotRefreshRp = self:getMallDailyAdLeftCount() > 0 -- 主要商品 钻石广告道具 local gemAdId = 1 -- 约定首位为免费栏位 local cfgInfo = self:getMallTreasureConfig()[gemAdId] local gemAdMaxTimes = cfgInfo and cfgInfo.daily or 0 local gemAdRp = gemAdMaxTimes - DataManager.ShopData:getGiftBoughtNum(PayManager.PURCHARSE_TYPE.MALL_TREASURE, gemAdId) > 0 -- 主要商品 金币广告道具 local coinAdId = 1 -- 约定首位为免费栏位 local cfgInfo = self:getMallGoldConfig()[coinAdId] local coinAdMaxTimes = cfgInfo and cfgInfo.daily or 0 local coinAdRp = coinAdMaxTimes - DataManager.ShopData:getCommonDailyCoinAdBuyCount() > 0 return (isHotOpen and (hotAdGoodsRp or hotRefreshRp)) or gemAdRp or coinAdRp end return ShopData