local FundChapterManager = class("FundChapterManager", BaseModule) function FundChapterManager:getReward(stage) if not DataManager.ChapterFundData:canGetRewards(stage) then return end self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterFundClaimedReq, {id = 0, grade = 0, stage = stage}, self.onGetReward, BIReport.ITEM_GET_TYPE.ACT_CHAPTER_FUND_REWARD) end function FundChapterManager:onGetReward(result) if result.err_code ~= GConst.ERROR_STR.SUCCESS then return end local currStage = result.reqData.stage local minId = DataManager.ChapterFundData:getMinUnclaimedRewardIndex(currStage) local maxId = DataManager.ChapterFundData:getMaxUnclaimedRewardIndex(currStage) minId = DataManager.ChapterFundData:getConfigIdByIndex(currStage, minId) maxId = DataManager.ChapterFundData:getConfigIdByIndex(currStage, maxId) local cur = DataManager.ChapterFundData:getMaxUnclaimedId() GFunc.showRewardBox(result.rewards) DataManager.ChapterFundData:initData(result.info) BIReport:postChapterFund(currStage, minId, maxId, cur, result.rewards) end function FundChapterManager:onBuyLevelGift(id) PayManager:purchasePackage(id, PayManager.PURCHARSE_TYPE.ACT_GIFT) end function BIReport:postChapterFund(stage, minId, maxId, curChapter, rewards) local args = { opt_type = "Reward", fund_stage = stage, min_id = minId, max_id = maxId, cur_chapter = curChapter, reward_str = rewards and GFunc.getRewardsStr(rewards) or nil, } self:report(BIReport.EVENT_NAME_CHAPTER_FUND, args) end return FundChapterManager