Преглед на файлове

Merge branch '360test' of http://43.226.57.217:3000/yishanyou/GongFuServer into 360test

# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
pigflower преди 1 месец
родител
ревизия
5407d8ddb9

+ 44 - 44
script/module/battle/BattleGift.lua

@@ -163,72 +163,72 @@ end
 
 -- 外部调用,跨天处理
 function updateDaily(human)
-    -- local battleGiftData = getData(human)
-    -- if not battleGiftData then
-    --     calcBeforeVal(human)
-    --     updateRedDot(human)
-    --     return
-    -- end
+    local battleGiftData = getData(human)
+    if not battleGiftData then
+        calcBeforeVal(human)
+        updateRedDot(human)
+        return
+    end
 
-    -- resetData(human)
+    resetData(human)
 
-    -- updateRedDot(human)
+    updateRedDot(human)
 end
 
 -- 外部调用, 登录处理
 function onLogin(human)
-    -- local battleGiftData = getData(human)
-    -- if not battleGiftData then
-    --     calcBeforeVal(human)
-    --     updateRedDot(human)
-    -- end
+    local battleGiftData = getData(human)
+    if not battleGiftData then
+        calcBeforeVal(human)
+        updateRedDot(human)
+    end
 end
 
 -- 外部调用, 通关新的关卡
 function StageClearHandle(human, currentStage, stageType)
-    -- local val = getStageVal(stageType, currentStage)
-    -- if val > 0 then
-    --     addDailyStoreVal(human, val)
-    -- end
+    local val = getStageVal(stageType, currentStage)
+    if val > 0 then
+        addDailyStoreVal(human, val)
+    end
 end
 
 -- 外部调用, 入口处是否有红点
 function isDot(human)
-    -- local battleGiftData = getData(human)
-    -- if not battleGiftData then
-    --     return false
-    -- end
-
-    -- local dailyStoreVal = battleGiftData.dailyStoreVal or 0
-    -- if dailyStoreVal <= 0 then
-    --     return false
-    -- end
-
-    -- local dailyGetVal = battleGiftData.dailyGetVal or 0
-    -- local dailyMaxVal = calclDailyMaxGetVal(human)
-    -- if dailyGetVal >= dailyMaxVal then
-    --     return false
-    -- end
-
-    -- return true
+    local battleGiftData = getData(human)
+    if not battleGiftData then
+        return false
+    end
+
+    local dailyStoreVal = battleGiftData.dailyStoreVal or 0
+    if dailyStoreVal <= 0 then
+        return false
+    end
+
+    local dailyGetVal = battleGiftData.dailyGetVal or 0
+    local dailyMaxVal = calclDailyMaxGetVal(human)
+    if dailyGetVal >= dailyMaxVal then
+        return false
+    end
+
+    return true
 end
 
 -- 外部调用, 充值处理接口
 function charge(human, nAllPrice, buyID)
-    -- if not table.find(EliteDefine.BATTLEGIFT_BUYID_LIST, buyID) then
-    --     return
-    -- end
+    if not table.find(EliteDefine.BATTLEGIFT_BUYID_LIST, buyID) then
+        return
+    end
 
-    -- local battleGiftData = getData(human)
-    -- if battleGiftData and battleGiftData.buyIdList and table.find(battleGiftData.buyIdList, buyID) then
-    --     return
-    -- end
+    local battleGiftData = getData(human)
+    if battleGiftData and battleGiftData.buyIdList and table.find(battleGiftData.buyIdList, buyID) then
+        return
+    end
 
-    -- insertBuyIdList(human, buyID)
+    insertBuyIdList(human, buyID)
 
-    -- updateRedDot(human)
+    updateRedDot(human)
 
-    -- BattleGift_Query(human)
+    BattleGift_Query(human)
 end
 
 

+ 61 - 42
script/module/serverCommerce/ServerCommerceActBattleGroundCS.lua

@@ -21,7 +21,7 @@ local dbUpdate = {_id=nil}
 local dbUpdateField = {}
 
 local RANK_SHOW_NUM = 50    -- 排行榜显示的数量
-local notifyActEnd = false  -- 是否收到活动结束通知的标识
+local repeateServerIdList = {}
 
 local battleGroundData = {
     -- allAreaRankList = { -- 各个战区排行榜, 榜上的都是真实玩家
@@ -149,6 +149,12 @@ function BattleGround_InitAfterStart()
     loadData()
 end
 
+function onZero()
+    if next(repeateServerIdList) then
+        repeateServerIdList = {}
+    end
+end
+
 
 -- 通过本服Id获取所在战区Id
 local function getWarZoneServerIdx(sourceServerId)
@@ -157,6 +163,11 @@ local function getWarZoneServerIdx(sourceServerId)
     return nServerKey
 end
 
+-- 通服务器Id获取所在战区Id的最小服务器Id,最大服务器Id
+local function getWarZoneServerArea(sourceServerId)
+    local nServerKey = MiddleConnect.MiddleConnect_TrueServerID2ConfServerID(sourceServerId)
+    return MiddleConnect.MiddleConnect_GetWarZoneServer(nServerKey)
+end
 
 -- 生成一个战区排行榜
 local function genWarZoneRankList(warZoneServerIdx)
@@ -467,73 +478,81 @@ function BG_N2C_Lineup_Update(msg)
     updateValue("allAreaRankList".."."..warZoneServerIdx, battleGroundData.allAreaRankList[warZoneServerIdx])
 end
 
+
+
 -- 活动结束
 function BG_N2C_Act_End(msg)
-    if notifyActEnd then
+    local warZoneServerIdMin, warZoneServerIdMax = getWarZoneServerArea(msg.sourceServerId)
+
+    if not warZoneServerIdMin or warZoneServerIdMin == 0 then
         return
     end
 
-    -- local logData = {
-    --     joinList = battleGroundData.joinList,
-    --     allAreaRankList = battleGroundData.allAreaRankList,
-    -- }
-
-    -- local logTb = Util.serialize(logData)
-    -- local logStr = table.concat(logTb)
-    -- writeLog(logStr)
-
-
-    local logTab1 = Util.serialize(battleGroundData.joinList)
-    local logStr1 = table.concat(logTab1)
-    Timer.addLater(40, writeLog, logStr1)
-
-    local logTab2 = Util.serialize(battleGroundData.allAreaRankList)
-    local logStr2 = table.concat(logTab2)
-    Timer.addLater(45, writeLog, logStr2)
-
+    if repeateServerIdList[warZoneServerIdMin] then
+        return
+    end
 
     -- 更新标识
-    notifyActEnd = true
+    repeateServerIdList[warZoneServerIdMin] = true
 
-    local fd_2_Rank = {}
+    local fd_2_PlayerList = {}
     local joinList = battleGroundData.joinList
-    local allAreaRankList = battleGroundData.allAreaRankList
+
+    local serverIdxMin = MiddleConnect.MiddleConnect_ConfServerID2TrueServerID(warZoneServerIdMin)
+    local serverIdxMax = MiddleConnect.MiddleConnect_ConfServerID2TrueServerID(warZoneServerIdMax)
 
     -- 参与玩家(包括在榜玩家)
-    for _, playerInfo in ipairs(joinList or {}) do
+    for k = #joinList, 1, -1 do
+        local playerInfo = joinList[k]
         local serverId = playerInfo[1]
-        local fd = MiddleManager.getFDBySvrIndex(serverId)
-        if fd then
-            fd_2_Rank[fd] = fd_2_Rank[fd] or {}
-            fd_2_Rank[fd][#fd_2_Rank[fd]+1] = {ServerCommerceActDefine.COMMERCEACT_NPC_CNT, playerInfo[2]}
+        if serverId >= serverIdxMin and serverId <= serverIdxMax then
+            local fd = MiddleManager.getFDBySvrIndex(serverId)
+            if fd then
+                fd_2_PlayerList[fd] = fd_2_PlayerList[fd] or {}
+                fd_2_PlayerList[fd][#fd_2_PlayerList[fd]+1] = {ServerCommerceActDefine.COMMERCEACT_NPC_CNT, playerInfo[2]}
+            end
+            table.remove(joinList, k)
         end
     end
 
     -- 在榜玩家
-    for _, rankList in pairs(allAreaRankList or {}) do
-        for _, player in pairs(rankList) do
-            local fd = MiddleManager.getFDBySvrIndex(player.serverId)
-            if fd then
-                fd_2_Rank[fd] = fd_2_Rank[fd] or {}
-                local idx = findVal(fd_2_Rank[fd], player.playerUuid)
-                if idx then
-                    fd_2_Rank[fd][idx][1] = player.rank
-                end
+    local myWarZoneRankList = getMyWarZoneRankList(msg.sourceServerId)
+    for _, player in pairs(myWarZoneRankList or {}) do
+        local fd = MiddleManager.getFDBySvrIndex(player.serverId)
+        if fd then
+            fd_2_PlayerList[fd] = fd_2_PlayerList[fd] or {}
+            local idx = findVal(fd_2_PlayerList[fd], player.playerUuid)
+            if idx then
+                fd_2_PlayerList[fd][idx][1] = player.rank
             end
         end
     end
 
-    if next(fd_2_Rank) then
+    if battleGroundData.allAreaRankList and battleGroundData.allAreaRankList[warZoneServerIdMin] then
+        battleGroundData.allAreaRankList[warZoneServerIdMin] = nil
+    end
+
+    if next(fd_2_PlayerList) then
+        -- 写日志
+        local logTab2 = Util.serialize(fd_2_PlayerList)
+        local logStr2 = table.concat(logTab2)
+        Timer.addLater(45, writeLog, logStr2)
+
         local delay_sec = 0
-        for fd, rankArr in pairs(fd_2_Rank) do
+        for fd, rankArr in pairs(fd_2_PlayerList) do
             delay_sec = delay_sec + 3
             Timer.addLater(delay_sec, issueReward, fd, rankArr)
         end
 
-        -- 重置排行榜数据
-        battleGroundData.joinList = nil
+        -- 更新数据
+        if not next(battleGroundData.joinList) then
+            battleGroundData.joinList = nil
+        end
         updateValue("joinList", battleGroundData.joinList)
-        battleGroundData.allAreaRankList = nil
+
+        if not next(battleGroundData.allAreaRankList) then
+            battleGroundData.allAreaRankList = nil
+        end
         updateValue("allAreaRankList", battleGroundData.allAreaRankList)
     end
 end

+ 3 - 0
script/module/serverCommerce/ServerCommerceMiddle.lua

@@ -11,6 +11,7 @@ local ServerCommerceManger = require("serverCommerce.ServerCommerceManager")
 local ServerCommerceActDefine = require("serverCommerce.ServerCommerceActDefine")
 local ServerCommerceRank = require("serverCommerce.ServerCommerceActRank")
 local Log = require("common.Log")
+local ServerCommerceActBattleGroundCS = require("serverCommerce.ServerCommerceActBattleGroundCS")
 
 
 -- 缓存开服天数
@@ -188,6 +189,8 @@ function CommerceMiddle_OnZero()
         return
     end
 
+    ServerCommerceActBattleGroundCS.onZero()
+
     Timer.addLater(15, CommerceMiddle_GetOpen)
     print("[CommerceMiddle_OnZero] 整点定时去获取数据")
 end