|
|
@@ -14,14 +14,19 @@ local DailyLeichong = require("present.DailyLeichong")
|
|
|
local LoginSignLogic = require("loginSign.LoginSignLogic")
|
|
|
local RoleSystemLogic = require("roleSystem.RoleSystemLogic")
|
|
|
local RoleSystemDefine = require("roleSystem.RoleSystemDefine")
|
|
|
-
|
|
|
+local MailExcel = require("excel.mail")
|
|
|
+local MailManager = require("mail.MailManager")
|
|
|
+local CommonDB = require("common.CommonDB")
|
|
|
+local Msg = require("core.Msg")
|
|
|
-- 专属客服充值额度
|
|
|
EXCLUSIVE_SERVER_9937 = 1000
|
|
|
|
|
|
TOPUP_LIBAO_ID1 = 1 --盲盒礼包
|
|
|
TOPUP_LIBAO_ID2 = 2 --铂金周卡
|
|
|
TOPUP_LIBAO_ID3 = 3 --365王卡
|
|
|
-
|
|
|
+local MAX_FIREWORKS_DURATION = 43200
|
|
|
+local YanhuaEmail = 7012
|
|
|
+local ItemId=1022
|
|
|
--封装直购基本信息
|
|
|
local function wrapTopupItem(net, config, human)
|
|
|
net.id = config.id
|
|
|
@@ -59,6 +64,29 @@ function clacTopupAcount(human, price, buyID)
|
|
|
LeichongHaoli.onAddMoney(human, price)
|
|
|
LeijiChongzhi.onAddMoney(human, price)
|
|
|
LoginSignLogic.chargeAfter(human)
|
|
|
+
|
|
|
+ sendFireworksMail(human,price)
|
|
|
+end
|
|
|
+
|
|
|
+-- 发送烟花邮件
|
|
|
+function sendFireworksMail(human, price)
|
|
|
+ if price < 100 then return end -- 如果充值金额小于100,不发送邮件
|
|
|
+
|
|
|
+ -- 计算烟花数量
|
|
|
+ local nFireWorksCount = math.floor(price / 100)
|
|
|
+ if 0 >= nFireWorksCount then
|
|
|
+ return
|
|
|
+ end
|
|
|
+ local mailCfg = MailExcel.mail[YanhuaEmail]
|
|
|
+ local title = mailCfg.title
|
|
|
+ local content = mailCfg.content
|
|
|
+ local senderName = mailCfg.senderName
|
|
|
+ local items = {
|
|
|
+ {itemID = ItemId, count = nFireWorksCount} -- 1022是烟花的道具ID
|
|
|
+ }
|
|
|
+
|
|
|
+ -- 调用邮件管理器发送邮件
|
|
|
+ MailManager.add(MailManager.SYSTEM, human.db._id, title, content, items, senderName)
|
|
|
end
|
|
|
|
|
|
function checkKf(human)
|
|
|
@@ -66,4 +94,43 @@ function checkKf(human)
|
|
|
if human.db.topupAcount ~= nil and human.db.topupAcount >= EXCLUSIVE_SERVER_9937 then
|
|
|
Msg.send(Msg.gc.GC_EXCLUSIVE_SERVER,human.fd)
|
|
|
end
|
|
|
+end
|
|
|
+
|
|
|
+--给客户端下发结束时间//定义的协议时间 //当客户端有点击请求的时候
|
|
|
+function DurationofBonus(human)
|
|
|
+ local tMsgData = Msg.gc.GC_FIREWORKS_QUERY
|
|
|
+ tMsgData.buffDuration = CommonDB.getFireWorksBonusTime()
|
|
|
+ Msg.send(tMsgData, human.fd)
|
|
|
+end
|
|
|
+
|
|
|
+function Addtime(human, fireworksCount)
|
|
|
+ local nNowTime = os.time()
|
|
|
+ if not human or fireworksCount <= 0 then
|
|
|
+ return
|
|
|
+ end
|
|
|
+ local currentEndTime = CommonDB.getFireWorksBonusTime()
|
|
|
+ local baseTime=nNowTime
|
|
|
+ if currentEndTime>nNowTime then
|
|
|
+ baseTime=currentEndTime
|
|
|
+ end
|
|
|
+ local addedTime = math.max(fireworksCount * 60,60)
|
|
|
+ local newEndTime=math.min(
|
|
|
+ baseTime + addedTime,
|
|
|
+ nNowTime + MAX_FIREWORKS_DURATION
|
|
|
+ )
|
|
|
+ local totalDuration=newEndTime-nNowTime
|
|
|
+ if totalDuration <=0 or totalDuration> MAX_FIREWORKS_DURATION then
|
|
|
+ return
|
|
|
+ end
|
|
|
+ CommonDB.setFireWorkBonusTime(newEndTime)
|
|
|
+ local tMsgData = Msg.gc.GC_FIREWORKS_SHOW
|
|
|
+ tMsgData.buffDuration = CommonDB.getFireWorksBonusTime()
|
|
|
+ tMsgData.playerName=human.db.Name
|
|
|
+
|
|
|
+ -- 下发时间给客户端时间和玩家名称
|
|
|
+ for _, human in pairs(ObjHuman.onlineUuid) do
|
|
|
+ if human and human.fd then
|
|
|
+ Msg.send(tMsgData, human.fd)
|
|
|
+ end
|
|
|
+ end
|
|
|
end
|