| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737 |
- --------------------------------
- -- 文件名 : ServerCommerceActManger.lua
- -- 文件说明 : 跨服商业-活动模板管理
- -- 创建时间 : 2025/03/26
- -- 创建人 : FC
- --------------------------------
- local Util = require("common.Util")
- local Lang = require("common.Lang")
- local Broadcast = require("broadcast.Broadcast")
- local MailExcel = require("excel.mail")
- local Msg = require("core.Msg")
- local ObjHuman = require("core.ObjHuman")
- local MailManager = require("mail.MailManager")
- local BagLogic = require("bag.BagLogic")
- local Grid = require("bag.Grid")
- local PanelDefine = require("broadcast.PanelDefine")
- local CommonDB = require("common.CommonDB")
- local BuyLogic = require("topup.BuyLogic")
- local GuideLogic = require("guide.GuideLogic")
- local Log = require("common.Log")
- local YunYingLogic = require("yunying.YunYingLogic")
- local ServerCommerceCof = require("excel.ServerCommerce")
- local ServerCommerceActDefine = require("serverCommerce.ServerCommerceActDefine")
- local Timer = require("core.Timer")
- local BuyConf = require("excel.buy")
- local ServerCommerceMiddle = require("serverCommerce.ServerCommerceMiddle")
- local ServerCommerceActCharge = require("serverCommerce.ServerCommerceActCharge")
- local ServerCommerceActRank = require("serverCommerce.ServerCommerceActRank")
- local ServerCommerceTask = require("serverCommerce.ServerCommerceActTask")
- -- 活动信息
- tCommerceActInfo = nil
- -- {
- -- nStartTime = nil, -- 开始时间
- -- nEendTime = nil, -- 结束时间
- -- isRun = nil, -- 是否在活动中
- -- nOpen = nil, -- 是否打开
- -- nBatchID = nil, -- 批次
- -- }
- -- 加载的模块
- tCommerceActModuel = {}
- ----------------------------------------- 内部处理开始 -------------------------------------
- -- 下发数据
- local function CommerceAct_SendData(tMsgData, fd)
- Msg.send(tMsgData, fd)
- end
- local function CommerceAct_CheckOpenDay()
- local nNowOpenDay = CommonDB.getServerOpenDay()
- return nNowOpenDay >= ServerCommerceActDefine.COMMERCEACT_SHOW_OPENDAY
- end
- -- 创建玩家DB数据
- function CommerceAct_CreateHumanDB(human)
- local nBatchID = 1
- local tCommonDBData = CommonDB.GetCommerceActInfo()
- if tCommonDBData and nil ~= _G.next(tCommonDBData) then
- nBatchID = tCommonDBData.nBatchID
- end
-
- human.db.ServerCommerce =
- {
- nPoint = 0, -- 当前玩家个人积分
- Task = {}, -- 任务信息
- Charge = {}, -- 连充豪礼
- Shop = {}, -- 战区钜惠
- nBatchID = nBatchID, -- 批次
- bSendPlayerMail = false, -- 是否发送个人邮件
- bSendServerMail = false, -- 是否发送全服邮件
- }
- for nID, module in pairs(tCommerceActModuel) do
- if module and module.CreatDB then
- local bRet = module.CreatDB(human)
- if false == bRet then
- print("[CommerceAct_CreateHumanDB] nID 初始化DB 数据失败 nID = "..nID)
- end
- end
- end
- end
- -- 下发活动数据
- function CommerceAct_SendActInfo(human)
- if not human or not tCommerceActInfo then
- return
- end
- if false == CommerceAct_CheckOpenDay() then
- return
- end
- print("[CommerceAct_SendActInfo] 下发活动数据 开始 ")
- local tMsgData = Msg.gc.GC_SERVEERCOMMERCE_ACT_ALLINFO
- tMsgData.nStartTime = tCommerceActInfo.nStartTime
- tMsgData.nEendTime = tCommerceActInfo.nEendTime
- tMsgData.tActID[0] = #ServerCommerceCof.CommerceAct
- local nIndex = 1
- for id, v in pairs(ServerCommerceCof.CommerceAct) do
- local tActData = tMsgData.tActID[nIndex]
- nIndex = nIndex + 1
- tActData.ID = id
- tActData.name = v.name
- tActData.nSortID = v.sortID
- tActData.nIcon = v.icon
- tActData.nPanelID = v.panelID
- local bRed = false
- if tCommerceActModuel[id] and tCommerceActModuel[id].isRed then
- bRed = tCommerceActModuel[id].isRed(human)
- end
-
- print("[CommerceAct_SendActInfo] name = "..tActData.name)
- tActData.nRed = (bRed == true) and 1 or 0
- end
- YunYingLogic.sendBanner(human)
- CommerceAct_SendData(tMsgData, human.fd)
- print("[CommerceAct_SendActInfo] 下发活动数据 结束 ")
- end
- -- 各个子活动重置活动数据
- local function CommerceAct_ResetData(human)
- if not human then
- return
- end
-
- end
- -- 各个子活动处理结束数据
- local function CommerceAct_HandleEndData(human)
- if not human then
- return
- end
- end
- -- 所有活动初始化数据开始
- local function CommerceAct_BeginAllAct(human)
- if not human or not tCommerceActInfo then
- return
- end
- CommerceAct_CreateHumanDB(human)
- print("[CommerceAct_BeginAllAct] 所有活动初始化数据开始 ")
- end
- -- 结束所有活动
- local function CommerceAct_EndAllAct(human)
- -- 各个子活动处理数据
- CommerceAct_HandleEndData(human)
- end
- -- 活动开始
- local function CommerceAct_Begin()
- if not tCommerceActInfo then
- return
- end
- for nID, module in pairs(tCommerceActModuel) do
- if module and module.ClearCache then
- module.ClearCache()
- end
- end
- -- 遍历在线玩家
- for uuid, human in pairs(ObjHuman.onlineUuid) do
- CommerceAct_BeginAllAct(human)
- CommerceAct_SendActInfo(human)
- end
- end
- -- 活动结束
- local function CommerceAct_End()
- -- 排行榜结束
- ServerCommerceMiddle.CommerceMiddle_QueryServerRank(ServerCommerceActDefine.COMMERCEACT_SENDSERVERMAIL)
- end
- -- 延迟向中心服请求数据
- local function CommerceAct_LaterTimeQuery(nOperate)
- print("[CommerceAct_LaterTimeQuery] 延迟向中心服请求数据开始")
- Timer.addLater(ServerCommerceActDefine.COMMERCEACT_INITSERVERTIME, CommerceAct_GetActOpen, nOperate)
- end
- -- 延迟10分钟开始
- local function CommerceAct_LaterBeginAct()
- if not tCommerceActInfo then
- return
- end
- tCommerceActInfo.isRun = true
- CommerceAct_Begin()
- end
- -- 检查活动是否过期
- local function CommerceAct_CheckActIsOverTime()
- local tCommerceDBInfo = CommonDB.GetCommerceActInfo()
- if not tCommerceDBInfo or nil == _G.next(tCommerceDBInfo) then
- return true
- end
- local nEndTime = tCommerceDBInfo.nEndTime
- local nNowTime = os.time()
- return nNowTime >= nEndTime
- end
- -- 检查是否开启下一轮活动
- local function CommerceAct_CanOpenNext()
- local tCommerceDBInfo = CommonDB.GetCommerceActInfo()
- if not tCommerceDBInfo or nil == _G.next(tCommerceDBInfo) then
- return true
- end
- local nDiffDay = Util.diffDay(tCommerceDBInfo.nEndTime)
- if nDiffDay >= ServerCommerceActDefine.COMMERCEACT_NEXTDAY then
- return true
- end
-
- return false
- end
- -- 创建通用DB数据
- local function CommerceAct_CreateCommonDB()
- local nNowTime = os.time()
- local tCommerceInfo = CommonDB.GetCommerceActInfo()
- local nEndTime = nNowTime + (ServerCommerceActDefine.COMMERCEACT_LASTDAY - 1)* 86400
- local tEndDate = os.date("*t",nEndTime)
- tEndDate.hour = ServerCommerceActDefine.COMMERCEACT_ENDTIME
- tEndDate.min = 0
- tEndDate.sec = 0
- nEndTime = os.time(tEndDate)
- local tDBData = {
- nBeginTime = nNowTime,
- nEndTime = nEndTime,
- nPoint = 0,
- nSendRankMail = false,
- }
- if not tCommerceInfo or nil == _G.next(tCommerceInfo) then
- tDBData.nBatchID = 1
- else
- if tDBData.nBatchID then
- tDBData.nBatchID = tDBData.nBatchID + 1
- else
- tDBData.nBatchID = 1
- end
- end
- CommonDB.SetCommerceActInfo(tDBData)
- end
- -- 创建缓存数据
- local function CommerceAct_CreateCacheInfo(nOpen, bLater)
- local tCommerceInfo = CommonDB.GetCommerceActInfo()
- if not tCommerceInfo or nil == _G.next(tCommerceInfo) then
- print("[CommerceAct_CreateCacheInfo] 为什么会不存在数据\n")
- return
- end
- tCommerceActInfo = {}
- tCommerceActInfo.nStartTime = tCommerceInfo.nBeginTime
- tCommerceActInfo.nEendTime = tCommerceInfo.nEndTime
- tCommerceActInfo.isRun = bLater == true and false or true
- tCommerceActInfo.nOpen = nOpen
- tCommerceActInfo.nBatchID = tCommerceInfo.nBatchID
- print("[CommerceAct_CreateCacheInfo] 创建缓存数据 nStartTime = "..tCommerceActInfo.nStartTime.." nEendTime = "..tCommerceActInfo.nEendTime
- .." nOpen = "..tCommerceActInfo.nOpen.." nBatchID = "
- ..tCommerceActInfo.nBatchID.." isRun = "..(tCommerceActInfo.isRun == true and 1 or 0))
- if bLater == true then
- Timer.addLater(ServerCommerceActDefine.COMMERCEACT_BEGINDELATTIME, CommerceAct_LaterBeginAct)
- else
- for uuid, human in pairs(ObjHuman.onlineUuid) do
- CommerceAct_SendActInfo(human)
- end
- end
- end
- -- 清理排行榜数据
- local function CommerceAct_ClearRankInfo()
- ServerCommerceMiddle.CommerceMiddle_ClearRank()
- end
- -- 起服初始化数据
- local function CommerceAct_ActCheckOpen_InitServer(nOpen, nOperate, nServerKey)
- if ServerCommerceActDefine.COMMERCEACT_NOOPEN ~= nOpen then
- local tCommerceInfo = CommonDB.GetCommerceActInfo()
- -- 不存在数据
- if not tCommerceInfo or nil == _G.next(tCommerceInfo) then
- print("[CommerceAct_ActCheckOpen_InitServer] 不存在commonDB数据开始创建")
- CommerceAct_CreateCommonDB()
- -- 清理排行榜数据
- CommerceAct_ClearRankInfo()
- else
- -- 存在数据检查是否结束
- if true == CommerceAct_CheckActIsOverTime() then
- local bOpenNext = CommerceAct_CanOpenNext()
- if true == bOpenNext then
- -- 开启下一轮
- if tCommerceInfo.nBatch < ServerCommerceActDefine.COMMERCEACT_ENDBATCH then
- CommerveManager_WriteLog("[CommerveManager-onZeroAll] 当前条件满足开启下一轮活动")
- CommerceAct_CreateCommonDB()
- -- 清理排行榜数据
- CommerceAct_ClearRankInfo()
- end
- end
- end
- end
- local bLater = nOperate == ServerCommerceActDefine.COMMERCEACT_ZERO and true or false
-
- CommerceAct_CreateCacheInfo(nOpen, bLater)
- ServerCommerceActRank.CommercerActRank_GetRankServerKey(nServerKey)
- ServerCommerceActRank.CommercerActRank_InitServerQueryRank()
- end
- end
- -- 获取玩家当前点数
- function CommerceAct_GetHumanPoint(human)
- return human.db.ServerCommerce.nPoint
- end
- -- 设置玩家当前点数
- local function CommerceAct_SetHumanPoint(human, nValue)
- human.db.ServerCommerce.nPoint = nValue
- end
- -- 获取开始时间
- function CommerceAct_GetOpenAndEndTime()
- if not tCommerceActInfo or not tCommerceActInfo.nStartTime or not tCommerceActInfo.nEendTime then
- return 0, 0
- end
- return tCommerceActInfo.nStartTime, tCommerceActInfo.nEendTime
- end
- ----------------------------------------- 外部调用开始 -------------------------------------
- function onZeroAll(funcID)
- local nNowTime = os.time()
- local tDate = os.date("*t",nNowTime)
- -- 活动未开启
- if tDate.hour == ServerCommerceActDefine.COMMERCEACT_BEGINTIME then
- -- 获取DB数据
- local tCommerceDBInfo = CommonDB.GetCommerceActInfo()
- if not tCommerceDBInfo or nil == _G.next(tCommerceDBInfo) then
- CommerceAct_LaterTimeQuery(ServerCommerceActDefine.COMMERCEACT_ZERO)
- return
- end
- -- 存在DB数据说明已经满足条件了
- if true == CommerceAct_CheckActIsOverTime() then
- local bOpenNext = CommerceAct_CanOpenNext()
- if false == bOpenNext then
- return
- end
- -- 开启下一轮
- if tCommerceDBInfo.nBatch < ServerCommerceActDefine.COMMERCEACT_ENDBATCH then
- CommerveManager_WriteLog("[CommerveManager-onZeroAll] 当前条件满足开启下一轮活动")
- CommerceAct_CreateCommonDB()
- -- 存在数据说明时间是满足的
- CommerceAct_CreateCacheInfo(ServerCommerceActDefine.COMMERCEACT_OPEN, true)
- -- 清理排行榜数据
- CommerceAct_ClearRankInfo()
- end
- end
- end
- end
- function onHour(hour)
- local nNowTime = os.time()
- local tDate = os.date("*t",nNowTime)
- print("[CommerceAct_onHour] 进入整点时间判断 hour = "..hour.." nNowTime = "..nNowTime)
- if tDate.hour == ServerCommerceActDefine.COMMERCEACT_ENDTIME then
- if not tCommerceActInfo or tCommerceActInfo.nOpen == ServerCommerceActDefine.COMMERCEACT_NOOPEN then
- return
- end
- local tCommerceDBInfo = CommonDB.GetCommerceActInfo()
- if not tCommerceDBInfo or nil == _G.next(tCommerceDBInfo) then
- print("[CommerceAct_onHour] 存在缓存数据, 但是获取不到DB数据")
- return
- end
- local nEndTime = tCommerceDBInfo.nEndTime
- print("[CommerceAct_onHour] nNowTime = "..nNowTime.." nEndTime = "..nEndTime)
- if nEndTime <= nNowTime then
- -- 活动结束处理
- CommerceAct_End()
- tCommerceActInfo.nSendRankMail = true
- tCommerceActInfo.isRun = false
- end
- end
- end
- -- 请求活动打开信息
- function CommerceAct_GetActOpen(nOperate)
- print("[CommerceAct_GetActOpen] 开始向中心服请求活动数据")
- ServerCommerceMiddle.CommerceMiddle_IsActOpen(nOperate)
- end
- -- 中心服回复活动信息
- function CommerceAct_ActCheckOpen(nOpen, nOperate, nServerKey)
- print("[CommerceAct_ActCheckOpen] 收到活动信息开始处理 nOpen = "..nOpen.." nOperate ="..nOperate)
- CommerceAct_ActCheckOpen_InitServer(nOpen, nOperate, nServerKey)
- end
- -- 起服初始化
- function CommerceAct_Init()
- if _G.is_middle == true then
- -- 中心服起服获取信息
- print("[CommerceAct_Init] 中心服起服请求数据开始")
- ServerCommerceMiddle.CommerceMiddle_InitServer()
- return
- end
- local nNowTime = os.time()
- for nID, v in pairs(ServerCommerceCof.CommerceAct) do
- if v.moduleFn then
- local moduleFn = load("return require(\"" .. v.moduleFn .. "\")")()
- if moduleFn then
- tCommerceActModuel[nID] = moduleFn
- if moduleFn.Init then
- local bRet = moduleFn.Init()
- if false == bRet then
- print("[CommerceAct_Init] 初始化模块数据失败 nID ".. nID)
- end
- end
- print("[CommerceAct_Init] 加载模块成功 name = "..v.name)
- else
- print("[CommerceAct_Init] 加载模块失败 nID ".. nID)
- end
- else
- print("[CommerceAct_Init] 未配置 name = "..v.name)
- end
- end
- print("[CommerceAct_Init] 延迟进行请求数据操作")
-
- -- 延迟向中心服请求数据
- CommerceAct_LaterTimeQuery(ServerCommerceActDefine.COMMERCEACT_SERVEROPEN)
- end
- -- 是否还在活动期间
- function CommerceAct_IsRun()
- if not tCommerceActInfo then
- return false
- end
- if false == CommerceAct_CheckOpenDay() then
- print("[CommerceAct_IsRun] 开服时间不符合条件 nNowOpenDay = ", CommonDB.getServerOpenDay())
- return false
- end
- return tCommerceActInfo.isRun
- end
- -- 玩家登录
- function onLogin(human, funcID)
- if not human then
- return
- end
- -- 下发活动基础数据
- if true == CommerceAct_IsRun() then
- print("[CommerceManger_onLogin] 玩家进入进行注册")
- local tCommonDBData = CommonDB.GetCommerceActInfo()
- if not tCommonDBData or nil == _G.next(tCommonDBData) then
- print("[CommerceManger_onLogin] 玩家登录不存在对应的数据通用DB数据!!!!")
- return
- end
- -- 不存在数据直接创建
- if not human.db.ServerCommerce then
- CommerceAct_CreateHumanDB(human)
- else
- -- 用记在玩家身上的批次 和 CommonDB 中的数据比较
- local nOldBatchID = human.db.ServerCommerce.nBatchID
- local nNowBatchID = tCommonDBData.nBatchID
- if nNowBatchID ~= nOldBatchID then
- CommerceAct_CreateHumanDB(human)
- end
- end
-
- CommerceAct_SendActInfo(human)
- for _, module in pairs(tCommerceActModuel) do
- if module and module.onLogin then
- module.onLogin(human)
- end
- end
- else
- -- 不在活动中
- local tCommonDBData = CommonDB.GetCommerceActInfo()
- if not tCommonDBData or nil == _G.next(tCommonDBData) then
- print("[CommerceManger_onLogin] 玩家登录不存在对应的数据通用DB数据!!!!")
- return
- end
- if false == CommerceAct_CheckActIsOverTime() then
- print("[CommerceManger_onLogin] 当前还在活动时间内,返回")
- return
- end
- -- 不存在对应DB数据
- if not human.db.ServerCommerce then
- return
- end
- -- 未发送个人邮件都是未上榜的
- local bSendPlayerMail = CommerveManager_GetHumanSendPlayerMail(human)
- if false == bSendPlayerMail then
- CommerveManager_SetHumanSendPlayerMail(human, true)
- ServerCommerceActRank.CommercerActRank_SendHumanMailHumanLogin(human)
- end
- -- 全服邮件
- local bSendServerMail = CommerveManager_GetHumanSendServerMail(human)
- if false == bSendServerMail and true == tCommonDBData.bSendServerMail then
- CommerveManager_SetHumanSendServerMail(human, true)
- ServerCommerceActRank.CommercerActRank_SendServerMailHumanLogin(human)
- end
- end
- end
- -- 是否开启
- function isOpen(human, YYInfo, funcConfig)
- if false == CommerceAct_CheckOpenDay() then
- return 0
- end
- local bRet = CommerceAct_IsRun()
- local nRet = bRet and 1 or 0
- print("CommerceAct_isOpen 结束 nRet = "..nRet)
- return bRet
- end
- --
- function isActive(human, YYInfo, funcConfig)
- return not isOpen(human, YYInfo, funcConfig)
- end
- function isRed(human, YYInfo, funcConfig)
- if false == CommerceAct_IsRun() then
- return
- end
- if false == CommerceAct_CheckOpenDay() then
- return
- end
- if not human.db.ServerCommerce then
- CommerceAct_CreateHumanDB(human)
- end
- local bRet
- for _, module in pairs(tCommerceActModuel) do
- if module and module.isRed then
- bRet = module.isRed(human)
- if true == bRet then
- break
- end
- end
- end
- return bRet
- end
- function onCharge(human, price, funcID, buyID)
- if not human then
- return
- end
- if false == CommerceAct_IsRun() then
- return
- end
-
- if not human.db.ServerCommerce then
- CommerceAct_CreateHumanDB(human)
- end
- print("[onCharge] 跨服商业活动 玩家充值回调开始 name = "..human.db.name.." price = "..price)
- for _, module in pairs(tCommerceActModuel) do
- if module and module.onCharge then
- module.onCharge(human, price, funcID, buyID)
- end
- end
- local tBuyCfg = BuyConf.buy[buyID]
- if tBuyCfg then
- local region = human.region or "CN"
- local nPoint = tBuyCfg[region]
- CommerveManager_AddServerPoint(nPoint)
- CommerveManager_AddHumanPint(human, nPoint)
- end
- end
- -- 增加整个服务器的点数
- function CommerveManager_AddServerPoint(nAddPoint)
- local tCommonDBData = CommonDB.GetCommerceActInfo()
- local nNewPoint = tCommonDBData.nPoint + nAddPoint
- CommonDB.SetCommerceActInfo_Point(nNewPoint)
- print("[CommerveManager_AddServerPoint] 增加整个服务器的点数 nAddPoint = "..nAddPoint.." nNewPoint = "..nNewPoint)
- for _, module in pairs(tCommerceActModuel) do
- if module and module.onAllPointChange then
- module.onAllPointChange()
- end
- end
- end
- -- 增加个人积分
- function CommerveManager_AddHumanPint(human, nPoint)
- local nNowPoint = CommerceAct_GetHumanPoint(human)
- local nNewPoint = nNowPoint + nPoint
- CommerceAct_SetHumanPoint(human ,nNewPoint)
- print("[CommerveManager_AddHumanPint] 增加个人积分 nAddPoint = "..nPoint.." nNewPoint = "..nNewPoint.." name = "..human.db.name)
- ServerCommerceActRank.CommercerActRank_HumanPointChange(human, nNewPoint)
- end
- -- 写日志
- function CommerveManager_WriteLog(szLogText, human)
- if human then
- szLogText = szLogText.." name = "..human.db.name.." id = "..human.db._id
- end
- Log.write(Log.LOGID_OSS_COMMON_ACT, szLogText)
- end
- -- 设置全服发送邮件奖励
- function CommerveManager_SetCommDBSendMail()
- local bSendMail = CommonDB.GetCommerceActInfo_SendServerMail()
- if nil == bSendMail then
- return
- end
- CommonDB.SetCommerceActInfo_SendServerMail(true)
- end
- -- 获取全服发送邮件标识
- function CommerveManager_GetCommDBSendMail()
- return CommonDB.GetCommerceActInfo_SendServerMail()
- end
- -- 设置玩家已经获取了全服奖励邮件
- function CommerveManager_SetHumanSendServerMail(human, nValue)
- human.db.ServerCommerce.bSendServerMail = nValue
- end
- -- 获取玩家全服奖励邮件状态
- function CommerveManager_GetHumanSendServerMail(human)
- return human.db.ServerCommerce.bSendServerMail
- end
- -- 设置玩家已经获取了个人奖励邮件
- function CommerveManager_SetHumanSendPlayerMail(human, nValue)
- human.db.ServerCommerce.bSendPlayerMail = nValue
- end
- -- 获取玩家全服奖励邮件状态
- function CommerveManager_GetHumanSendPlayerMail(human)
- return human.db.ServerCommerce.bSendPlayerMail
- end
- -- GM 清理数据
- function CommerveManager_GMClear(human)
- human.db.ServerCommerce =
- {
- nPoint = 0, -- 当前玩家个人积分
- Task = {}, -- 任务信息
- Charge = {}, -- 连充豪礼
- Shop = {}, -- 战区钜惠
- nBatchID = 1, -- 批次
- bSendPlayerMail = false, -- 是否发送个人邮件
- bSendServerMail = false, -- 是否发送全服邮件
- }
- for nID, module in pairs(tCommerceActModuel) do
- if module and module.CreatDB then
- local bRet = module.CreatDB(human)
- if false == bRet then
- print("[CommerceAct_CreateHumanDB] nID 初始化DB 数据失败 nID = "..nID)
- end
- end
- end
- table.print_lua_table(human.db.ServerCommerce)
- print("[CommerveManager_GMClear] 玩家重置数据完成 name = "..human.db.name)
- end
- -- GM 增加个人积分
- function CommerveManager_GMAddHumanPoint(human, nNum)
- CommerveManager_AddHumanPint(human, nNum)
- end
- -- GM 增加服务器积分
- function CommerveManager_GMAddServerPoint(nNum)
- CommerveManager_AddServerPoint(nNum)
- end
- -- GM 发送邮件
- function CommerveManager_SendMail()
- CommonDB.SetCommerceActInfo_SendServerMail(false)
- CommerceAct_End()
- end
- function CommerceMiddle_AddTaskPoint(human, nNum)
- ServerCommerceTask.CommerceTask_AddPoint(human, nNum)
- end
- function CommerveManager_GMRest(human)
- CommerceAct_End()
- print("[CommerveManager_GMRest] 发送邮件处理完成")
-
- CommonDB.SetCommerceActInfo({})
- print("[CommerveManager_GMRest] 处理公共DB数据结束")
- CommerceAct_ClearRankInfo()
- print("[CommerveManager_GMRest] 发送清理排行榜命令完成")
- CommerceAct_GetActOpen(ServerCommerceActDefine.COMMERCEACT_SERVEROPEN)
- print("[CommerveManager_GMRest] 重新请求数据")
- end
|