|
@@ -44,6 +44,7 @@ local AbsReachRankDB = require("absAct.AbsReachRankDB")
|
|
|
local FestivalSevenDayCardLogic = require("absAct.FestivalSevenDayCardLogic")
|
|
local FestivalSevenDayCardLogic = require("absAct.FestivalSevenDayCardLogic")
|
|
|
local DailyFixedTaskLogic = require("absAct.DailyFixedTaskLogic")
|
|
local DailyFixedTaskLogic = require("absAct.DailyFixedTaskLogic")
|
|
|
local AbsSignGiftLogic = require("absAct.AbsSignGiftLogic")
|
|
local AbsSignGiftLogic = require("absAct.AbsSignGiftLogic")
|
|
|
|
|
+local NewHeroLogic = require("absAct.NewHeroLogic")
|
|
|
|
|
|
|
|
ABS_ACT_TYPE_LIST = nil
|
|
ABS_ACT_TYPE_LIST = nil
|
|
|
function initAfterHot()
|
|
function initAfterHot()
|
|
@@ -54,7 +55,16 @@ function initAfterHot()
|
|
|
for k, config in pairs(AbsActExcel.absActivity) do
|
|
for k, config in pairs(AbsActExcel.absActivity) do
|
|
|
config.realStartTime = config.realStartTime or 0
|
|
config.realStartTime = config.realStartTime or 0
|
|
|
config.realEndTime = config.realEndTime or 0
|
|
config.realEndTime = config.realEndTime or 0
|
|
|
-
|
|
|
|
|
|
|
+ if next(config.startDate) and next(config.endDate) then
|
|
|
|
|
+ config.startDate.hour = 0
|
|
|
|
|
+ config.startDate.min = 0
|
|
|
|
|
+ config.startDate.sec = 0
|
|
|
|
|
+ config.endDate.hour = 0
|
|
|
|
|
+ config.endDate.min = 0
|
|
|
|
|
+ config.endDate.sec = 0
|
|
|
|
|
+ config.realStartTime = os.time(config.startDate)
|
|
|
|
|
+ config.realEndTime = os.time(config.endDate)
|
|
|
|
|
+ end
|
|
|
ABS_ACT_TYPE_LIST[config.type] = ABS_ACT_TYPE_LIST[config.type] or {}
|
|
ABS_ACT_TYPE_LIST[config.type] = ABS_ACT_TYPE_LIST[config.type] or {}
|
|
|
ABS_ACT_TYPE_LIST[config.type][#ABS_ACT_TYPE_LIST[config.type] + 1] = k
|
|
ABS_ACT_TYPE_LIST[config.type][#ABS_ACT_TYPE_LIST[config.type] + 1] = k
|
|
|
end
|
|
end
|
|
@@ -62,14 +72,31 @@ end
|
|
|
|
|
|
|
|
function onLogin(human)
|
|
function onLogin(human)
|
|
|
local sendLisg = {}
|
|
local sendLisg = {}
|
|
|
|
|
+ local absActConfig = AbsActExcel.absActivity
|
|
|
|
|
+ -- 清除过期活动
|
|
|
|
|
+ for id in pairs(human.db.absAct) do
|
|
|
|
|
+ checkAbsActClean(human,id)
|
|
|
|
|
+ end
|
|
|
|
|
+ -- 是否有新增活动
|
|
|
|
|
+ for k,v in pairs(absActConfig) do
|
|
|
|
|
+ local ok = isStarted(human,k)
|
|
|
|
|
+ if ok and not human.db.absAct[k] then
|
|
|
|
|
+ human.db.absAct[k] = {}
|
|
|
|
|
+ local f = load("return require(\"" .. v.moduleFn .. "\")")()
|
|
|
|
|
+ if f and f.genAbsActData then
|
|
|
|
|
+ human.db.absAct[k] = f.genAbsActData()
|
|
|
|
|
+ end
|
|
|
|
|
+ end
|
|
|
|
|
+ end
|
|
|
|
|
+ -- 登录奖励重置
|
|
|
for k, config in pairs(AbsActExcel.absLogin) do
|
|
for k, config in pairs(AbsActExcel.absLogin) do
|
|
|
local state,id = isStartedByType(human, config.absType)
|
|
local state,id = isStartedByType(human, config.absType)
|
|
|
- if state then
|
|
|
|
|
- checkAbsActClean(human, id)
|
|
|
|
|
- if config.type == AbsActDefine.ABS_LOGIN_REWARD_TYPE_1 and not human.db.absAct[id].openGet then
|
|
|
|
|
- human.db.absAct[id].openGet = 1
|
|
|
|
|
- sendLisg[#sendLisg + 1] = k
|
|
|
|
|
- elseif config.type == AbsActDefine.ABS_LOGIN_REWARD_TYPE_2 then
|
|
|
|
|
|
|
+ if state and id then
|
|
|
|
|
+ if not human.db.absAct[id] then
|
|
|
|
|
+ human.db.absAct[id] = {}
|
|
|
|
|
+ end
|
|
|
|
|
+ -- 每日登录领取
|
|
|
|
|
+ if config.type == AbsActDefine.ABS_LOGIN_REWARD_TYPE_2 then
|
|
|
local lastTime = human.db.absAct[id].loginDayGetTime or 0
|
|
local lastTime = human.db.absAct[id].loginDayGetTime or 0
|
|
|
if not Util.isSameDay(lastTime) then
|
|
if not Util.isSameDay(lastTime) then
|
|
|
human.db.absAct[id].loginDayGetTime = os.time()
|
|
human.db.absAct[id].loginDayGetTime = os.time()
|
|
@@ -93,16 +120,34 @@ function onLogin(human)
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
|
|
+local function transTime(cfg)
|
|
|
|
|
+ local realEndTime = 0
|
|
|
|
|
+ local realStartTime = 0
|
|
|
|
|
+ local state = false
|
|
|
|
|
+ if next(cfg.startDate) and next(cfg.endDate) then
|
|
|
|
|
+ cfg.startDate.hour = 0
|
|
|
|
|
+ cfg.startDate.min = 0
|
|
|
|
|
+ cfg.startDate.sec = 0
|
|
|
|
|
+ cfg.endDate.hour = 0
|
|
|
|
|
+ cfg.endDate.min = 0
|
|
|
|
|
+ cfg.endDate.sec = 0
|
|
|
|
|
+ realStartTime = os.time(cfg.startDate)
|
|
|
|
|
+ realEndTime = os.time(cfg.endDate)
|
|
|
|
|
+ state = true
|
|
|
|
|
+ end
|
|
|
|
|
+ return state, realEndTime, realStartTime
|
|
|
|
|
+end
|
|
|
|
|
+
|
|
|
-- 判断活动是否开启
|
|
-- 判断活动是否开启
|
|
|
function isStarted(human, id)
|
|
function isStarted(human, id)
|
|
|
local config = AbsActExcel.absActivity[id]
|
|
local config = AbsActExcel.absActivity[id]
|
|
|
if not config then return end
|
|
if not config then return end
|
|
|
-
|
|
|
|
|
|
|
+ local _,realEndTime,realStartTime = transTime(config)
|
|
|
local now = os.time()
|
|
local now = os.time()
|
|
|
- if now < config.realStartTime or now >= config.realEndTime then
|
|
|
|
|
|
|
+ if now < realStartTime or now >= realEndTime then
|
|
|
return
|
|
return
|
|
|
end
|
|
end
|
|
|
- return true, config.realEndTime, config.realStartTime
|
|
|
|
|
|
|
+ return true, realEndTime, realStartTime
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
-- 判断活动是否开启
|
|
-- 判断活动是否开启
|
|
@@ -111,8 +156,9 @@ function isStartedByType(human, type)
|
|
|
|
|
|
|
|
for k, v in ipairs(ABS_ACT_TYPE_LIST[type]) do
|
|
for k, v in ipairs(ABS_ACT_TYPE_LIST[type]) do
|
|
|
local config = AbsActExcel.absActivity[v]
|
|
local config = AbsActExcel.absActivity[v]
|
|
|
- if config and isStarted(human, v) == true then
|
|
|
|
|
- return true, v, config.realEndTime, config.realStartTime
|
|
|
|
|
|
|
+ local ok , realEndTime,realStartTime = isStarted(human,v)
|
|
|
|
|
+ if config and ok then
|
|
|
|
|
+ return true, v, realEndTime, realStartTime
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
@@ -128,22 +174,14 @@ end
|
|
|
|
|
|
|
|
function checkAbsActClean(human, id)
|
|
function checkAbsActClean(human, id)
|
|
|
local config = AbsActExcel.absActivity[id]
|
|
local config = AbsActExcel.absActivity[id]
|
|
|
- if human.db.absAct[id] and human.db.absAct[id].endTime == config.realEndTime then
|
|
|
|
|
- else
|
|
|
|
|
- -- 两个卡不清 领完才能清
|
|
|
|
|
- if config.type == AbsActDefine.ABS_ACT_TYPE_12 then -- 铂金周卡
|
|
|
|
|
- if not human.db.absAct[id] then
|
|
|
|
|
- human.db.absAct[id] = { endTime = config.realEndTime }
|
|
|
|
|
- end
|
|
|
|
|
-
|
|
|
|
|
- elseif config.type == AbsActDefine.ABS_ACT_TYPE_13 then -- 365王卡
|
|
|
|
|
- if not human.db.absAct[id] then
|
|
|
|
|
- human.db.absAct[id] = { endTime = config.realEndTime }
|
|
|
|
|
- end
|
|
|
|
|
-
|
|
|
|
|
- else
|
|
|
|
|
- human.db.absAct[id] = { endTime = config.realEndTime }
|
|
|
|
|
- end
|
|
|
|
|
|
|
+ local _,realEndTime = transTime(config)
|
|
|
|
|
+ local now = os.time()
|
|
|
|
|
+ if human.db.absAct[id] and now >= realEndTime then
|
|
|
|
|
+ -- 累计达标中的 累计充值到期 需要发送邮件
|
|
|
|
|
+ if config.type == AbsActDefine.ABS_ACT_TYPE_71 then
|
|
|
|
|
+ TotalReachLogic.clean(human,id)
|
|
|
|
|
+ end
|
|
|
|
|
+ human.db.absAct[id] = nil
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
|
|
|
|
@@ -158,11 +196,10 @@ function actDetailQuery(human, id)
|
|
|
-- 判断活动是否开启
|
|
-- 判断活动是否开启
|
|
|
local startFlag = isStarted(human, id)
|
|
local startFlag = isStarted(human, id)
|
|
|
if startFlag == nil then
|
|
if startFlag == nil then
|
|
|
|
|
+ checkAbsActClean(human, id)
|
|
|
return Broadcast.sendErr(human, Lang.ACT_NOT_START)
|
|
return Broadcast.sendErr(human, Lang.ACT_NOT_START)
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
- checkAbsActClean(human, id)
|
|
|
|
|
-
|
|
|
|
|
if config.type == AbsActDefine.ABS_ACT_TYPE_1 then-- 超值礼包
|
|
if config.type == AbsActDefine.ABS_ACT_TYPE_1 then-- 超值礼包
|
|
|
PremiumGiftLogic.getAndSendMsg(human, id, config.actId)
|
|
PremiumGiftLogic.getAndSendMsg(human, id, config.actId)
|
|
|
elseif config.type == AbsActDefine.ABS_ACT_TYPE_2 then-- 盲盒
|
|
elseif config.type == AbsActDefine.ABS_ACT_TYPE_2 then-- 盲盒
|
|
@@ -227,6 +264,8 @@ function actDetailQuery(human, id)
|
|
|
DailyFixedTaskLogic.getAndSendMsg(human, id)
|
|
DailyFixedTaskLogic.getAndSendMsg(human, id)
|
|
|
elseif config.type == AbsActDefine.ABS_ACT_TYPE_33 then
|
|
elseif config.type == AbsActDefine.ABS_ACT_TYPE_33 then
|
|
|
FestivalSevenDayCardLogic.getAndSendMsg(human, id)
|
|
FestivalSevenDayCardLogic.getAndSendMsg(human, id)
|
|
|
|
|
+ elseif config.type == AbsActDefine.ABS_ACT_TYPE_35 then
|
|
|
|
|
+ NewHeroLogic.getAndSendMsg(human, id)
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
|
|
|