local AbsActLogic = require("absAct.AbsActLogic")
local MangHeLogic = require("absAct.MangHeLogic")
local PerpleHeroLogic = require("absAct.PerpleHeroLogic")
local HeroLogLogic = require("absAct.HeroLogLogic")
local DropExchangeLogic = require("absAct.DropExchangeLogic")
local AbsJifenDrawLogic = require("absAct.AbsJifenDrawLogic")
local HeroLoginPickLogic = require("absAct.HeroLoginPickLogic")
local AbsZhanbuLunpanLogic = require("absAct.AbsZhanbuLunpanLogic")
local RechargeBackLogic = require("absAct.RechargeBackLogic")
local HeroGrowUp = require("absAct.HeroGrowUp")
local Abs365CardLogic = require("absAct.Abs365CardLogic")
local HeroComeLogic = require("absAct.HeroComeLogic")
local WishGiftLogic = require("absAct.WishGiftLogic")
local EveryDayPrayLogic = require("absAct.EveryDayPrayLogic")
local AbsSurpriseChest = require("absAct.AbsSurpriseChest")
local SpecialCustomLogic = require("absAct.SpecialCustomLogic")
local SevenDayLogic = require("absAct.SevenDayLogic")
local DrumBlastingLogic = require("absAct.DrumBlastingLogic")
local PremiumGiftLogic = require("absAct.PremiumGiftLogic")
local ExclusiveTaskLogic = require("absAct.ExclusiveTaskLogic")
local UseDiamondLogic = require("absAct.UseDiamondLogic")
local WishCupLogic = require("absAct.WishCupLogic")
local SingleReachLogic = require("absAct.SingleReachLogic")
local TotalReachLogic = require("absAct.TotalReachLogic")
local AbsOpenServerTotalConsume = require("absAct.AbsOpenServerTotalConsume")
local AbsReachRankLogic = require("absAct.AbsReachRankLogic")
local DailyFixedTaskLogic = require("absAct.DailyFixedTaskLogic")
local FestivalSevenDayCardLogic = require("absAct.FestivalSevenDayCardLogic")
local AbsSignGiftLogic = require("absAct.AbsSignGiftLogic")
local NewHeroLogic = require("absAct.NewHeroLogic")
local LotteryByDiamondLogic = require("absAct.LotteryByDiamondLogic")
local DuoBaoQiBingLogic = require("absAct.DuoBaoQiBingLogic")
local AbsLoginRewardLogic = require("absAct.AbsLoginRewardLogic")
local AbsDiscountStoreLogic = require("absAct.AbsDiscountStoreLogic")
local AbsExcellentGiftLogic = require("absAct.AbsExcellentGiftLogic")
local AbsLotteryCardLogic = require("absAct.AbsLotteryCardLogic")
local BusOneActivityTask = require("absAct.BusOneActivityTask")
local BusOneActivityBuy = require("absAct.BusOneActivityBuy")
local BusOneActivityYuanZheng = require("absAct.BusOneActivityYuanZheng")
local BusOneActivityHero = require("absAct.BusOneActivityHeroYuanZheng")
local CycleSevenDayTask = require("absAct.CycleSevenDayTask")
local CycleHeroSendGift = require("absAct.CycleHeroSendGift")
local CycleBreakThrough = require("absAct.CycleBreakThrough")
local CycleMakeFood = require("absAct.CycleMakeFood")
local BusThreeActGrandGift = require("absAct.BusThreeActGrandGift")
local BusThreeActDisStore = require("absAct.BusThreeActDiscountStore")
local BusThreeActTask = require("absAct.BusThreeActTask")
local BusThreeActDice = require("absAct.BusThreeActDice")
local CommonActBoss = require("absAct.CommonActBoss")
local CommonActShop = require("absAct.CommonActShop")
local CommonActCharge = require("absAct.CommonActCharge")
local CommonActFindTreasure = require("absAct.CommonActFindTreasure")
local CommonActLoginGift = require("absAct.CommonActLoginGift")
local CommonActMoneyTree = require("absAct.CommonActMoneyTree")
local AnniversaryActiveWheel  = require("absAct.AnniversaryActiveWheel")
local AnniversaryVoucherWheel = require("absAct.AnniversaryVoucherWheel")

function CG_ABS_ACT_DETAIL_QUERY(human, msg)
    -- local Log = require("common.Log")

    local success, err = pcall(function()
        AbsActLogic.actDetailQuery(human,msg.id)
    end)
    
    -- if not success then
    --     Log.write(Log.LOGID_DEBUG, "[CG_ABS_ACT_DETAIL_QUERY] 执行失败 - 玩家: "..tostring(human.db and human.db.name or "nil")..", 活动ID: "..tostring(msg.id)..", 错误: "..tostring(err))
    -- end
end

-- 盲盒成就 查询
function CG_ABS_ACT_MANGHE_CJ_QUERY(human, msg)
    MangHeLogic.queryCj(human)
end

-- 盲盒 概率查询
function CG_ABS_ACT_MANGHE_RARE_QUERY(human, msg)
    MangHeLogic.queryRare(human)
end

-- 盲盒 抽奖
function CG_ABS_ACT_MANGHE_DO(human, msg)
    MangHeLogic.draw(human, msg.cnt)
end

-- 盲盒 成就领奖
function CG_ABS_ACT_MANGHE_CJ_GET(human)
    MangHeLogic.cjGet(human)
end

-- 盲盒 每日领奖
function CG_ABS_ACT_MANGHE_MR_GET(human, msg)
    MangHeLogic.mrGet(human, msg.id)
end

function CG_ABS_ACT_PERPLE_HERO_SET(human,msg)
    PerpleHeroLogic.setPerpleHero(human,msg.perpleHero,msg.id)
end

function CG_ABS_ACT_PERPLE_HERO_COMBAT(human,msg)
    PerpleHeroLogic.heroCombat(human,msg.heroID)
end

function CG_ABS_ACT_GET_HERO_LOG_BOX(human,msg)
    HeroLogLogic.getBoxReward(human,msg.index,msg.id)
end

function CG_ABS_ACT_GET_HERO_LOG_TASK(human,msg)
    HeroLogLogic.getTaskReward(human,msg.index,msg.id)
end


function CG_ABS_ACT_DROP_SHOP_QUERY(human)
    DropExchangeLogic.shopQuery(human)
end

function CG_ABS_ACT_DROP_GIFT_QUERY(human)
    DropExchangeLogic.giftQuery(human)
end

function CG_ABS_ACT_DROP_SHOP_BUY(human, msg)
    DropExchangeLogic.shopBuy(human, msg.id, msg.buyCnt)
end

-- 积分召唤 兑换英雄
function CG_ABS_ACT_JIFEN_DRAW_BUY(human, msg)
   AbsJifenDrawLogic.buy(human, msg.id, msg.actID)
end

-- 英灵传说
function CG__ABS_ACT_HERO_LOGIN_PICK(human, msg)
    HeroLoginPickLogic.get(human, msg.type, msg.id, msg.param)
end

-- 占卜轮盘抽奖
function CG_ABS_ZHAN_BU_LUA_PAN_GET(human, msg)
    AbsZhanbuLunpanLogic.get(human, msg.id)
end

-- 超值礼包钻石购买
function CG_ABS_ACT_PREMIUM_GIFT_BUY(human, msg)
    PremiumGiftLogic.giftBuy(human, msg.id, msg.giftid)
end

function CG_ABS_RECHARGE_BACK_GET(human, msg)
    RechargeBackLogic.get(human, msg.panelID, msg.id)
end

function CG_HERO_GROWUP_TASK_QUERY(human, msg)
    HeroGrowUp.sendTaskQuery(human, msg.mainType)
end

function CG_HERO_GROWUP_TASK_GET(human, msg)
    HeroGrowUp.getTaskItems(human, msg.id)
end

function CG_HERO_GROWUP_KING_QUERY(human)
    HeroGrowUp.sendKingQuery(human)
end

function CG_HERO_GROWUP_REWARD_QUERY(human)
    HeroGrowUp.sendRewardQuery(human)
end

function CG_HERO_GROWUP_LV_GET(human,msg)
    HeroGrowUp.getLvReward(human,msg.lv)
end

function CG_HERO_GROWUP_BUY_JIFEN(human,msg)
    HeroGrowUp.buyJifen(human,msg.itemID,msg.cnt)
end

function CG_ABS_365CARD_GET(human,msg)
    Abs365CardLogic.get(human,msg.actId)
end

function CG_ABS_365CARD_DRAW(human,msg)
   Abs365CardLogic.draw(human,msg.actId)
end

-- 新英雄来袭-英雄降临-设置心仪英雄
function CG_ABS_ACT_HERO_COME_SET(human,msg)
    HeroComeLogic.setPerpleHero(human,msg.perpleHero,msg.id)
end

function CG_ABS_ACT_HERO_COME_COMBAT(human,msg)
    HeroComeLogic.heroCombat(human,msg.heroID)
end

-- 新英雄来袭-夙愿礼盒-钻石购买
function CG_ABS_ACT_WISH_GIFT_BUY(human, msg)
    WishGiftLogic.giftBuy(human, msg.id, msg.giftid)
end

-- 新英雄来袭-每日祈福-领取
function CG_ABS_ACT_EVERY_DAY_PRAY_GET(human, msg)
    EveryDayPrayLogic.get(human, msg.type, msg.id, msg.param)
end

-- 新英雄来袭-惊喜宝箱-领取完成任务奖励
function CG_ABS_SURPRISE_CHEST_GET(human, msg)
    AbsSurpriseChest.get(human, msg.actId, msg.day)
end

-- 新英雄来袭-惊喜宝箱-补领任务奖励
function CG_ABS_SURPRISE_CHEST_BU_GET(human, msg)
    AbsSurpriseChest.buGet(human, msg.actId, msg.day)
end

-- 新英雄来袭-专属任务-箱子奖励
function CG_ABS_ACT_GET_EXCLUSIVE_TASK_BOX(human,msg)
    ExclusiveTaskLogic.getBoxReward(human,msg.index,msg.id)
end

-- 新英雄来袭-专属任务-任务奖励
function CG_ABS_ACT_GET_EXCLUSIVE_TASK_TASK(human,msg)
    ExclusiveTaskLogic.getTaskReward(human,msg.index,msg.id)
end

function CG_ABS_ND_SEVEN_DAY_GET(human,msg)
    SevenDayLogic.getItem(human,msg.day,msg.actId)
end

function CG_ABS_ND_DRUM_GET(human,msg)
    DrumBlastingLogic.get(human,msg.id,msg.type,msg.actId)
end

function CG_ABS_ND_CUSTOM_CHOSE_ITEM(human,msg)
    SpecialCustomLogic.selectItem(human,msg.id,msg.giftId,msg.first,msg.second,msg.third)
end


function CG_ABS_ND_CUSTOM_GET(human,msg)
    SpecialCustomLogic.customBuy(human,msg.id,msg.args)
end

function CG_ABS_HF_USE_DIAMOND_GET(human,msg)
    UseDiamondLogic.getUseDiamondReward(human,msg.actId,msg.id)
end


function CG_ABS_HF_WISH_CUP_SELECT(human,msg)
    WishCupLogic.selectCup(human,msg.actId,msg.one,msg.two,msg.three)
end

function CG_ABS_XS_REACH_GET(human,msg)
    TotalReachLogic.getTotalReachReward(human,msg.actId,msg.id)
end

function CG_ABS_XS_SINGLE_REACH_GET(human,msg)
    SingleReachLogic.getSingleReachReward(human,msg.actId,msg.id)
end

function CG_ABS_OPEN_SERVER_REACH_GET(human, msg)
    AbsOpenServerTotalConsume.get(human, msg.funcID, msg.id)
end

-- ABS公共排行
function CG_ABS_REACH_RANK_REWARD_QUERY(human, msg)
    AbsReachRankLogic.rewardQuery(human, msg.actId, msg.funcRankType)
end

--
function CG_ABS_DAILY_FIXED_TASK_GET(human, msg)
    DailyFixedTaskLogic.getItem(human, msg.actId, msg.giftId)
end

function CG_ABS_SIGNGIFT_REWARD(human, msg)
    AbsSignGiftLogic.getItem(human, msg.id, msg.funcID, msg.type)
end

function CG_ABS_NEWHERO_BUYGIFT(human, msg)
    NewHeroLogic.giftBuy(human, msg.id)
end

------------------------古玉充能活动抽奖-----------------------
function CG_LOTTERYBYDIAMONDS_LOTTERY(human, msg)
    LotteryByDiamondLogic.Lottery(human, msg.id, msg.type)
end

----------------------夺宝奇兵活动----------------------------
function CG_DBQB_LOTTERY(human, msg)
    DuoBaoQiBingLogic.Lottery(human, msg.id, msg.pos)
end

function CG_DBQB_RESET(human, msg)
    DuoBaoQiBingLogic.ResetAwardPool(human, msg.id, msg.type)
end

function CG_DBQB_START_GAME(human, msg)
    DuoBaoQiBingLogic.StartGame(human, msg.id)
end

function CG_DBQB_TIPS(human, msg)
    DuoBaoQiBingLogic.CloseTips(human, msg.id)
end


--------------------------------------------------新商业化活动——登录豪礼--------------------------------------------------
function CG_LOGINREWARD_GET_REWARD(human, msg)
    AbsLoginRewardLogic.GetReward(human, msg.id, msg.day)
end


--------------------------------------------------新商业化活动——特价商店--------------------------------------------------
function CG_DISCOUNTSTORE_BUY(human, msg)
    AbsDiscountStoreLogic.BuyItem(human, msg.id, msg.idx, msg.buyCnt)
end

--------------------------------------------------新商业化活动——超值豪礼--------------------------------------------------
function CG_EXCELLENTGIFT_QUERY(human, msg)
    AbsExcellentGiftLogic.Query(human, msg.id, msg.page)
end


function CG_EXCELLENTGIFT_GET_REWARD(human, msg)
    AbsExcellentGiftLogic.GetReward(human, msg.id, msg.taskIdx, msg.page)
end

function CG_EXCELLENTGIFT_FINISH_TASK(human, msg)
    AbsExcellentGiftLogic.FinishTaskByDiamond(human, msg.id, msg.taskIdx, msg.page)
end

-----------------------------------------------------新商业化活动——秘境翻牌--------------------------------------------------
function CG_LOTTERYCARD_LOTTERY(human, msg)
    AbsLotteryCardLogic.Lottery(human, msg.id, msg.lotteryCnt)
end

function CG_LOTTERYCARD_RESET(human, msg)
    AbsLotteryCardLogic.ResetAward(human, msg.id)
end

-----------------------------------------------------新商业化活动1——每日任务--------------------------------------------------
function CG_NEW_BUSONEACT_TASK_QUERY(human, msg)
    BusOneActivityTask.BusOneTask_Query(human)
end

function CG_NEW_BUSONEACT_TASK_GET(human, msg)
    BusOneActivityTask.BusOneTask_Get(human)
end

-----------------------------------------------------新商业化活动1——超值大礼--------------------------------------------------
function CG_NEW_BUSONEACT_BUY_QUERY(human, msg)
    BusOneActivityBuy.BusOneBuy_Query(human)
end

function CG_NEW_BUSONEACT_BUY_BUYFREE(human, msg)
    BusOneActivityBuy.BusOneBuy_Buy(human, msg.nID)
end

function CG_NEW_BUSONEACT_BUY_GET(human, msg)
    -- BusOneActivityBuy.BusOneBuy_Get(human)
end

-----------------------------------------------------新商业化活动1——远征豪礼--------------------------------------------------
function CG_NEW_BUSONEACT_YUANZHENG_QUERY(human, msg)
    BusOneActivityYuanZheng.BusOneYuanZheng_Query(human)
end

function CG_NEW_BUSONEACT_YUANZHENG_GET(human, msg)
    BusOneActivityYuanZheng.BusOneYuanZheng_Get(human)
end

-----------------------------------------------------新商业化活动1——英雄远征--------------------------------------------------
function CG_NEW_BUSONEACT_HERO_QUERY(human, msg)
    BusOneActivityHero.BusOneHeroYuanZheng_Query(human)
end

function CG_NEW_BUSONEACT_HERO_JOIN(human, msg)
    BusOneActivityHero.BusOneHeroYuanZheng_Join(human)
end

function CG_NEW_BUSONEACT_HERO_DO(human, msg)
    BusOneActivityHero.BusOneHeroYuanZheng_Do(human, msg.nOperate)
end

function CG_NEW_BUSONEACT_HERO_GET(human, msg)
    BusOneActivityHero.BusOneHeroYuanZheng_Get(human, msg.nLayers, msg.nIndex)
end


----------------------------------------- 新商业化活动2 —— 7日任务--------------------------------------------

function CG_CYCLESEVENDAYTASK_QUERY(human, msg)
    CycleSevenDayTask.Query(human, msg.dayIdx)
end

function CG_CYCLESEVENDAYTASK_GET_REWARD(human, msg)
    CycleSevenDayTask.GetReward(human, msg.rewardType, msg.idx)
end


----------------------------------------- 新商业化活动2 —— 英雄赠礼-------------------------------------------

function CG_CYCLHEROSENDGIFT_QUERY(human, msg)
    CycleHeroSendGift.Query(human, msg.actId)
end

function CG_CYCLHEROSENDGIFT_GET_REWARD(human, msg)
    CycleHeroSendGift.GetReward(human, msg.actId)
end


----------------------------------------- 新商业化活动2 —— 6元闯关-------------------------------------------

function CG_CYCLEBREAKTHROUGH_QUERY(human, msg)
    CycleBreakThrough.Query(human, msg.actId)
end

function CG_CYCLEBREAKTHROUGH_RAND(human, msg)
    CycleBreakThrough.RandPos(human, msg.actId)
end

----------------------------------------- 新商业化活动2 —— 烹饪嘉年华-------------------------------------------

function CG_CYCLMAKEFOOD_QUERY(human, msg)
    CycleMakeFood.Query(human, msg.actId) 
end

function CG_CYCLMAKEFOOD_MAKEFOOD(human, msg)
    CycleMakeFood.MakeFood(human, msg.actId, msg.foodStr)
end

function CG_CYCLMAKEFOOD_GET_5STARfOODLIST(human, msg)
    CycleMakeFood.Get5StarFoodArray(human, msg.actId)
end

function CG_CYCLMAKEFOOD_SELECT_MUL(human, msg)
    CycleMakeFood.SelectTenTimes(human, msg.actId, msg.opType)
end

-----------------------------------------------------新商业化活动3 — 天选豪礼--------------------------------------------------
function CG_NEW_BUSTHREEACT_GRANDGIFT_QUERY(human, msg)
    BusThreeActGrandGift.BusThreeGrandGift_Query(human)
end

function CG_NEW_BUSTHREEACT_GRANDGIFT_GET(human, msg)
    BusThreeActGrandGift.BusThreeGrandGift_Get(human)
end

-----------------------------------------------------新商业化活动3 — 特价商店--------------------------------------------------
function CG_NEW_BUSTHREEACT_DISQUERY(human, msg)
    BusThreeActDisStore.Query(human)
end

function CG_NEW_BUSTHREEACT_DISBUY(human, msg)
    BusThreeActDisStore.BuyItem(human, msg.id, msg.idx, msg.buyCnt)
end

-----------------------------------------------------新商业化活动3 — 任务 --------------------------------------------------
function CG_NEW_BUSTHREEACT_TASKQUERY(human, msg)
    print("[CG_NEW_BUSTHREEACT_TASKQUERY] 玩家请求任务信息 name = "..human.db.name)
    BusThreeActTask.BusThreeActTask_QueryTask(human, msg.nDay)
end

function CG_NEW_BUSTHREEACT_GETTASKPRIZE(human, msg)
    BusThreeActTask.BusThreeActTask_GetTaskPrize(human, msg.nDay)
end

function CG_NEW_BUSTHREEACT_TASKPOINTQUERY(human, msg)
    print("[CG_NEW_BUSTHREEACT_TASKPOINTQUERY] 玩家请求任务积分信息 name = "..human.db.name)
    BusThreeActTask.BusThreeActTask_QueryTaskPoint(human)
end

function CG_NEW_BUSTHREEACT_GETTASKPOINTPRIZE(human, msg)
    BusThreeActTask.BusThreeActTask_GetTaskPointPrize(human)
end

-----------------------------------------------------新商业化活动3 — 天选骰子 --------------------------------------------------
function CG_NEW_BUSTHREEACT_DICEDO(human, msg)
    BusThreeActDice.BusThreeActDice_DO(human, msg.nNum)
end


----------------------------------------------------通用节日活动 — 个人BOSS --------------------------------------------------
function CG_ABS_FESTIVAL_BOSS_QUERY(human, msg)
    CommonActBoss.CommonActBoss_Query(human)
end

function CG_ABS_FESTIVAL_BOSS_REWARD(human, msg)
    CommonActBoss.CommonActBoss_QueryPrize(human)
end

function CG_ABS_FESTIVAL_BOSS_GET(human, msg)
    CommonActBoss.CommonActBoss_GetPrize(human)
end

----------------------------------------------------通用节日活动 — 商店 --------------------------------------------------
function CG_ABS_FESTIVAL_SHOP_QUERY(human, msg)
    CommonActShop.CommonActShop_Query(human)
end

function CG_ABS_FESTIVAL_SHOP_BUY(human, msg)
    CommonActShop.CommonActShop_Buy(human, msg.nID, msg.nCnt)
end

----------------------------------------------------通用节日活动 — 充值 --------------------------------------------------
function CG_ABS_FESTIVAL_RECHARGE_QUERY(human, msg)
    CommonActCharge.CommonActCharge_Query(human)
end

function CG_ABS_FESTIVAL_RECHARGE_GET(human, msg)
    CommonActCharge.CommonActCharge_Get(human, msg.nID)
end

----------------------------------------------------通用节日活动 — 限时寻宝 --------------------------------------------------
function CG_ABS_FESTIVAL_SEVENDAY_CARD_QUERY(human, msg)
    CommonActFindTreasure.CommonActFindTreasure_Query(human)
end

function CG_ABS_FESTIVAL_SEVENDAY_CARD_DO(human, msg)
    CommonActFindTreasure.CommonActFindTreasure_Do(human, msg.nType)
end


----------------------------------------------------通用节日活动 — 登录豪礼 --------------------------------------------------

function CG_ABS_COMONACT_LOGINGIFT_QUERY(human, msg)
    CommonActLoginGift.CommonActLoginGift_Query(human)
end

function CG_ABS_COMONACT_LOGINGIFT_GET_REWARD(human, msg)
    CommonActLoginGift.CommonActLoginGift_GetReward(human, msg.giftType)
end


----------------------------------------------------通用节日活动 — 摇钱树 --------------------------------------------------

function CG_ABS_COMONACT_MONEYTREE_QUERY(human, msg)
    CommonActMoneyTree.CommonActMoneyTree_Query(human)
end

function CG_ABS_COMONACT_MONEYTREE_LOTTERY(human, msg)
    CommonActMoneyTree.CommonActMoneyTree_Lottery(human)
end

function CG_ABS_COMONACT_MONEYTREE_GET_REWARD(human, msg)
    CommonActMoneyTree.CommonActMoneyTree_GetReward(human)
end

function CG_ABS_COMONACT_MONEYTREE_LOTTERY_STAGE(human, msg)
    CommonActMoneyTree.CommonActMoneyTree_EnterLotteryStage(human)
end



function CG_ANNIV_ACTIVE_WHEEL_QUERY(human, msg)
    AnniversaryActiveWheel.ActiveWheel_Query(human)
end
function CG_ANNIV_ACTIVE_WHEEL_SINGLE(human, msg)
    AnniversaryActiveWheel.ActiveWheel_Single(human)
end
function CG_ANNIV_ACTIVE_WHEEL_TEN(human, msg)
    AnniversaryActiveWheel.ActiveWheel_Ten(human)
end
----------------------------------------------------周年活动 — 代金转转乐 --------------------------------------------------
function CG_ANNIV_VOUCHER_WHEEL_QUERY(human, msg)
    AnniversaryVoucherWheel.VoucherWheel_Query(human)
end
function CG_ANNIV_VOUCHER_WHEEL_SINGLE(human, msg)
    AnniversaryVoucherWheel.VoucherWheel_Single(human)
end
function CG_ANNIV_VOUCHER_WHEEL_TEN(human, msg)
    AnniversaryVoucherWheel.VoucherWheel_Ten(human)
end