Просмотр исходного кода

战报功能 跨服改为本服 修复

249435196@qq.com 1 год назад
Родитель
Сommit
12804fe7ce
2 измененных файлов с 92 добавлено и 82 удалено
  1. 57 52
      script/module/warReport/WarReportLogic.lua
  2. 35 30
      script/module/warReport/WarReportMiddle.lua

+ 57 - 52
script/module/warReport/WarReportLogic.lua

@@ -1,5 +1,5 @@
 -------------------------------------------------------
--- 战
+-- 战锟斤拷
 
 -- 
 -------------------------------------------------------
@@ -29,21 +29,21 @@ local RoleSystemDefine = require("roleSystem.RoleSystemDefine")
 local ItemDefine = require("bag.ItemDefine")
 local HeroGrowUp = require("absAct.HeroGrowUp")
 
-WAR_REPORT_1 = 1 -- 冠军联赛
-WAR_REPORT_2 = 2 -- 王者争霸
-WAR_REPORT_3 = 3 -- 天梯
-WAR_REPORT_4 = 4 -- 切磋
+WAR_REPORT_1 = 1 -- 锟节撅拷锟斤拷锟斤拷
+WAR_REPORT_2 = 2 -- 锟斤拷锟斤拷锟斤拷锟斤拷
+WAR_REPORT_3 = 3 -- 锟斤拷锟斤拷
+WAR_REPORT_4 = 4 -- 锟叫达拷
 WAR_COUNT_MAX  = 30    
 WAR_COUNT_MAX1 = 20
 WAR_JJC_RANK   = 20
 WAR_FRIEND_RANK  = 30
-WAR_ADMIRE = 3   -- 点赞次数
-WAR_COMBATINFO_PLAYBACK = 1  -- 请求战斗数据用于回方
-WAR_COMBATINFO_HARM     = 2  -- 请求战斗数据用于伤害列表
-WAR_OP_CONFIRM = 1  --确
-WAR_OP_CANCEL = 0  --取
-WAP_OP_TYPE1 = 1 --点赞
-WAP_OP_TYPE2 = 2 --收藏
+WAR_ADMIRE = 3   -- 锟斤拷锟睫达拷锟斤拷
+WAR_COMBATINFO_PLAYBACK = 1  -- 锟斤拷锟斤拷战锟斤拷锟斤拷锟斤拷锟斤拷锟节回凤拷
+WAR_COMBATINFO_HARM     = 2  -- 锟斤拷锟斤拷战锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟剿猴拷锟叫憋拷
+WAR_OP_CONFIRM = 1  --确锟斤拷
+WAR_OP_CANCEL = 0  --取锟斤拷
+WAP_OP_TYPE1 = 1 --锟斤拷锟斤拷
+WAP_OP_TYPE2 = 2 --锟秸诧拷
 WAP_REWARD_GOD = 3000
 
 local war_report_count = {
@@ -110,12 +110,12 @@ end
 
 
 function initAfterStart()
-   -- 非中心服返回
+   -- 锟斤拷锟斤拷锟侥凤拷锟斤拷锟斤拷
    if _G.is_middle ~= true then
       return
    end
 
-   -- 添加记录索引
+   -- 锟斤拷锟接硷拷录锟斤拷锟斤拷
    local war_count_data = {}
    LuaMongo.find(DB.db_war_report, war_count_query)
    if LuaMongo.next(war_count_data) then
@@ -129,12 +129,12 @@ function initAfterStart()
 end
 
 -- db_war_report
--- 添加记录 所有记录存中心服
+-- 锟斤拷锟接硷拷录 锟斤拷锟叫硷拷录锟斤拷锟斤拷锟侥凤拷
 function add(type, combatInfo, atkRank, defRank)
-    -- 优化帧数据 降低
+    -- 锟脚伙拷帧锟斤拷锟斤拷 锟斤拷锟斤拷
     CombatLogic.killFrames(combatInfo)
 
-   if _G.is_middle == true then
+   if not _G.is_middle then
        WarReportMiddle.LW_WARREPORT_ADD(type, combatInfo, atkRank, defRank)
        return 
    end
@@ -147,25 +147,26 @@ function add(type, combatInfo, atkRank, defRank)
    InnerMsg.sendMsg(0, msgInner)
 end
 
--- 
+-- 锟斤拷
 function query(human, type, questType)
    if RoleSystemLogic.isOpen(human, RoleSystemDefine.ROLE_SYS_ID_202) ~= true then
 	  return
    end
 
-   -- 天梯赛请求中心服 或者 个人收藏 先去中心服找数据
-   local msgInner = InnerMsg.lw.LW_WARREPORT_QUERY
+   -- 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟侥凤拷 锟斤拷锟斤拷 锟斤拷锟斤拷锟秸诧拷 锟斤拷去锟斤拷锟侥凤拷锟斤拷锟斤拷锟斤拷
+   --[[local msgInner = InnerMsg.lw.LW_WARREPORT_QUERY
+   local msgInner = {}
    msgInner.uuid = human.db._id
    msgInner.type = type
    msgInner.questType = questType
    msgInner.warReport = human.db.warReport
-   InnerMsg.sendMsg(0, msgInner)
-   
-    human.db.warDot = nil
-    RoleSystemLogic.onDot(human, RoleSystemDefine.ROLE_SYS_ID_202)
+   InnerMsg.sendMsg(0, msgInner)]]
+   WarReportMiddle.LW_WARREPORT_QUERY(0,type,human.db._id,human.db.warReport,questType)
+   human.db.warDot = nil
+   RoleSystemLogic.onDot(human, RoleSystemDefine.ROLE_SYS_ID_202)
 end
 
--- 打包战报列表
+-- 锟斤拷锟秸斤拷锟斤拷斜锟�
 local makeReportQuery = {war_index = { ["$exists"] = 1}}
 function makeReport(type)
    local len = 0
@@ -189,7 +190,7 @@ function makeReport(type)
    return war_data_list
 end
 
--- 打包收藏
+-- 锟斤拷锟斤拷詹锟�
 local makeCollectReportQuery = {_id = nil}
 function makeCollectReport(collect)
    local war_data_list = {}
@@ -216,7 +217,7 @@ function makeCollectReport(collect)
 end
 
 
--- 打包我的战报
+-- 锟斤拷锟斤拷业锟秸斤拷锟�
 local makeMyReportQuery = {}
 function makeMyReport(uuid)
    local len = 0
@@ -242,7 +243,7 @@ function makeMyReport(uuid)
 end
 
 
--- 推送战报列表
+-- 锟斤拷锟斤拷战锟斤拷锟叫憋拷
 local heroOther = {}
 function sendReport(human, war_data_list, questType)
     local len = #war_data_list
@@ -253,7 +254,7 @@ function sendReport(human, war_data_list, questType)
     msgRet.isEnd = 0
     local sendLen = 0
 
-    -- 刷新收藏
+    -- 刷锟斤拷锟秸诧拷
     if questType == WAP_OP_TYPE2 then
        human.db.warReport = {}
     end
@@ -284,18 +285,18 @@ function sendReport(human, war_data_list, questType)
         net.isCollect = 0
         net.isAdmire = 0
 
-        -- 重置收藏列表
+        -- 锟斤拷锟斤拷锟秸诧拷锟叫憋拷
         if questType == WAP_OP_TYPE2 then
            warReport[net.type] = warReport[net.type] or {}
            warReport[net.type][net.id] = 1
         end
 
-        -- 是否已点赞
+        -- 锟角凤拷锟窖碉拷锟斤拷
         if war.admireList and war.admireList[human.db._id] then
             net.isAdmire = 1
         end
 
-        -- 是否已收藏
+        -- 锟角凤拷锟斤拷锟秸诧拷
         for _, list in pairs(warReport) do
             if list[net.id] then
                 net.isCollect = 1
@@ -338,18 +339,19 @@ function sendReport(human, war_data_list, questType)
 
 end
 
--- 伤害记
+-- 锟剿猴拷锟斤拷
 function harm(human, type, id)
-   -- 天梯赛请求中心服
-   local msgInner = InnerMsg.lw.LW_WARREPORT_GET_COMBATINFO
+   -- 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟侥凤拷
+   local msgInner = {} --InnerMsg.lw.LW_WARREPORT_GET_COMBATINFO
    msgInner.uuid = human.db._id
    msgInner.type = type
    msgInner.id = id
    msgInner.mode = WAR_COMBATINFO_HARM
-   InnerMsg.sendMsg(0, msgInner)
+   --InnerMsg.sendMsg(0, msgInner)
+   WarReportMiddle.LW_WARREPORT_GET_COMBATINFO(0,msgInner)
 end
 
--- 战斗结果
+-- 战锟斤拷锟斤拷锟�
 function sendFinish(human, combatInfo)
     if not combatInfo then return end
 	local msgRet = Msg.gc.GC_WAR_REPROT_HARM
@@ -359,19 +361,20 @@ function sendFinish(human, combatInfo)
 	Msg.send(msgRet,human.fd)
 end
 
--- 回放
+-- 锟截凤拷
 function playBack(human, type, id)
-   -- 天梯赛请求中心服
-   local msgInner = InnerMsg.lw.LW_WARREPORT_GET_COMBATINFO
+   -- 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟侥凤拷
+   local msgInner = {} --InnerMsg.lw.LW_WARREPORT_GET_COMBATINFO
    msgInner.uuid = human.db._id
    msgInner.type = type
    msgInner.id = id
    msgInner.mode = WAR_COMBATINFO_PLAYBACK
-   InnerMsg.sendMsg(0, msgInner)
+   --InnerMsg.sendMsg(0, msgInner)
+   WarReportMiddle.LW_WARREPORT_GET_COMBATINFO(0,msgInner)
 end
 
 
--- 操作结果
+-- 锟斤拷锟斤拷锟斤拷锟�
 function opResult(human, opType, id, result)
    local msgRet = Msg.gc.GC_WAR_REPORT_OP_RESULT
    msgRet.opType = opType
@@ -380,7 +383,7 @@ function opResult(human, opType, id, result)
    Msg.send(msgRet,human.fd)
 end
 
--- 收藏
+-- 锟秸诧拷
 function collect(human, type, id, op)
    if op ~= WAR_OP_CONFIRM and op ~= WAR_OP_CANCEL then
       return
@@ -388,12 +391,12 @@ function collect(human, type, id, op)
 
    local warReport = human.db.warReport
    if op == WAR_OP_CONFIRM then
-      -- 已经在收藏列表
+      -- 锟窖撅拷锟斤拷锟秸诧拷锟叫憋拷
       if warReport[type] and warReport[type][id] then
          return
       end
 
-      -- 收藏条数
+      -- 锟秸诧拷锟斤拷锟斤拷
       local collectCnt = 0
       for k, v in pairs(warReport) do
          for _, data in pairs(v) do
@@ -411,15 +414,16 @@ function collect(human, type, id, op)
       end
    end
 
-   local msgInner = InnerMsg.lw.LW_WARREPORT_COLLECT
+   local msgInner = {} --InnerMsg.lw.LW_WARREPORT_COLLECT
    msgInner.uuid = human.db._id
    msgInner.type = type
    msgInner.id = id
    msgInner.op = op
-   InnerMsg.sendMsg(0, msgInner)
+   --InnerMsg.sendMsg(0, msgInner)
+   WarReportMiddle.LW_WARREPORT_COLLECT(0,msgInner)
 end
 
--- 收藏回馈
+-- 锟秸藏伙拷锟斤拷
 function collectHumanDo(human, type, id, op)
    if op ~= WAR_OP_CONFIRM and op ~= WAR_OP_CANCEL then
       return
@@ -437,7 +441,7 @@ function collectHumanDo(human, type, id, op)
    opResult(human, WAP_OP_TYPE2, id, op)
 end
 
--- 点赞
+-- 锟斤拷锟斤拷
 function admire(human, type, id)
    if human.db.warAdmire == nil then
       return Broadcast.sendErr(human, Lang.WAR_REPORT_ADMIRE_NOT_ENOUGH) 
@@ -451,13 +455,14 @@ function admire(human, type, id)
    
 	HeroGrowUp.onCallback(human, HeroGrowUp.TASKTYPE6, 1)
 
-   local msgInner = InnerMsg.lw.LW_WARREPORT_ADMIRE
+   local msgInner = {} --InnerMsg.lw.LW_WARREPORT_ADMIRE
    msgInner.uuid = human.db._id
    msgInner.id = id
-   InnerMsg.sendMsg(0, msgInner)
+   --InnerMsg.sendMsg(0, msgInner)
+   WarReportMiddle.LW_WARREPORT_ADMIRE(0,msgInner)
 end
 
--- 点赞回馈
+-- 锟斤拷锟睫伙拷锟斤拷
 function admireDo(human, id)
    BagLogic.cleanMomentItemList()
    BagLogic.updateMomentItem(BagLogic.ADDITEM_TYPE_1, ItemDefine.ITEM_JINBI_ID, WAP_REWARD_GOD)

+ 35 - 30
script/module/warReport/WarReportMiddle.lua

@@ -1,5 +1,5 @@
 -------------------------------------------------------
--- 战
+-- 战锟斤拷
 
 --
 -------------------------------------------------------
@@ -15,7 +15,7 @@ local war_count_query = { war = 1 }
 local war_report_id = { _id = nil }
 local war_report_query = { war_index = nil, type = nil }
 
--- 获取战报数据
+-- 锟斤拷取战锟斤拷锟斤拷锟斤拷
 local function getWarReport(id)
     war_report_id._id = id
     local war_report_data = { }
@@ -26,7 +26,7 @@ local function getWarReport(id)
     return war_report_data
 end
 
--- 收藏
+-- 锟秸诧拷
 local function collectDo(type, id, op)
     if op ~= WarReportLogic.WAR_OP_CONFIRM and op ~= WarReportLogic.WAR_OP_CANCEL then
         return
@@ -46,13 +46,13 @@ local function collectDo(type, id, op)
     return true
 end
 
--- 点赞确认
+-- 锟斤拷锟斤拷确锟斤拷
 local function admire(id, uuid)
 
     local war_report_data = getWarReport(id)
     if not war_report_data then return end
 
-    -- 已经点赞
+    -- 锟窖撅拷锟斤拷锟斤拷
     if war_report_data.admireList and
         war_report_data.admireList[uuid] then
         return
@@ -65,10 +65,10 @@ local function admire(id, uuid)
     return true
 end
 
--- 添加数据
+-- 锟斤拷锟斤拷锟斤拷锟斤拷
 function LW_WARREPORT_ADD(type, combatInfo, atkRank, defRank)
     
-    -- 没有索引 返回
+    -- 没锟斤拷锟斤拷锟斤拷 锟斤拷锟斤拷
     local war_data = { }
     LuaMongo.find(DB.db_war_report, war_count_query)
     if not LuaMongo.next(war_data) then
@@ -93,25 +93,25 @@ function LW_WARREPORT_ADD(type, combatInfo, atkRank, defRank)
     warReport.defRank = defRank
     warReport.time = os.time()
 
-    -- 覆盖掉最后一场 减少录像数据
+    -- 锟斤拷锟角碉拷锟斤拷锟揭伙拷锟� 锟斤拷锟斤拷录锟斤拷锟斤拷锟斤拷
     if LuaMongo.next(war_report_data) then
         if war_report_data.collect and war_report_data.collect > 0 then
-           -- 有收藏的 删掉索引
+           -- 锟斤拷锟秸藏碉拷 删锟斤拷锟斤拷锟斤拷
            LuaMongo.update(DB.db_war_report, war_report_query, { ["$unset"] = { ["war_index"] = 1 } })
 
-           -- 插入新的数据
+           -- 锟斤拷锟斤拷锟铰碉拷锟斤拷锟斤拷
            LuaMongo.insert(DB.db_war_report, warReport)
 
         else
 
-           -- 没有收藏的覆盖掉
+           -- 没锟斤拷锟秸藏的革拷锟角碉拷
            LuaMongo.update(DB.db_war_report, war_report_query, warReport)
         end
     else
         LuaMongo.insert(DB.db_war_report, warReport)
     end
 
-    -- 更新索引
+    -- 锟斤拷锟斤拷锟斤拷锟斤拷
     if war_index >= WarReportLogic.WAR_COUNT_MAX then
         war_index = 1
     else
@@ -122,7 +122,7 @@ function LW_WARREPORT_ADD(type, combatInfo, atkRank, defRank)
 end
 
 
--- [战报] 请求数据
+-- [战锟斤拷] 锟斤拷锟斤拷锟斤拷锟斤拷
 function LW_WARREPORT_QUERY(fd, type, uuid, warReport, questType)
     local war_data_list = nil
     if questType == 1 then
@@ -135,14 +135,16 @@ function LW_WARREPORT_QUERY(fd, type, uuid, warReport, questType)
 
     if not war_data_list then return end
 
-    local msgInner = InnerMsg.wl.WL_WARREPORT_QUERY
+    --local msgInner = InnerMsg.wl.WL_WARREPORT_QUERY
+    local msgInner = {}
     msgInner.uuid = uuid
     msgInner.warReport = war_data_list
     msgInner.questType = questType
-    InnerMsg.sendMsg(fd, msgInner)
+    --InnerMsg.sendMsg(fd, msgInner)
+    WL_WARREPORT_QUERY(_,msgInner)
 end
 
--- [战报] 数据返回
+-- [战锟斤拷] 锟斤拷锟捷凤拷锟斤拷
 function WL_WARREPORT_QUERY(fd, msg)
     local human = ObjHuman.onlineUuid[msg.uuid]
     if not human then return end
@@ -150,19 +152,20 @@ function WL_WARREPORT_QUERY(fd, msg)
     WarReportLogic.sendReport(human, msg.warReport, msg.questType)
 end
 
--- [战报] 战斗伤害记
+-- [战锟斤拷] 战锟斤拷锟剿猴拷锟斤拷
 function LW_WARREPORT_GET_COMBATINFO(fd, msg)
     local war_report_data = getWarReport(msg.id)
     if not war_report_data then return end
 
-    local msgInner = InnerMsg.wl.WL_WARREPORT_GET_COMBATINFO
+    local msgInner = {} --InnerMsg.wl.WL_WARREPORT_GET_COMBATINFO
     msgInner.uuid = msg.uuid
     msgInner.mode = msg.mode
     msgInner.combatInfo = war_report_data.combatInfo
-    InnerMsg.sendMsg(fd, msgInner)
+    --InnerMsg.sendMsg(fd, msgInner)
+    WL_WARREPORT_GET_COMBATINFO(fd,msgInner)
 end
 
--- [战报] 战斗伤害记录 回放
+-- [战锟斤拷] 战锟斤拷锟剿猴拷锟斤拷录 锟截凤拷
 function WL_WARREPORT_GET_COMBATINFO(fd, msg)
     local human = ObjHuman.onlineUuid[msg.uuid]
     if not human then return end
@@ -176,7 +179,7 @@ function WL_WARREPORT_GET_COMBATINFO(fd, msg)
     end
 end
 
--- [战报] 收藏
+-- [战锟斤拷] 锟秸诧拷
 function LW_WARREPORT_COLLECT(fd, msg)
     local war_report_data = getWarReport(msg.id)
     if not war_report_data then return end
@@ -185,15 +188,16 @@ function LW_WARREPORT_COLLECT(fd, msg)
         return
     end
 
-    local msgInner = InnerMsg.wl.WL_WARREPORT_COLLECT
+    local msgInner = {} --InnerMsg.wl.WL_WARREPORT_COLLECT
     msgInner.uuid = msg.uuid
     msgInner.type = msg.type
     msgInner.id = msg.id
     msgInner.op = msg.op
-    InnerMsg.sendMsg(fd, msgInner)
+    --InnerMsg.sendMsg(fd, msgInner)
+    WL_WARREPORT_COLLECT(fd,msgInner)
 end
 
--- [战报] 收藏
+-- [战锟斤拷] 锟秸诧拷
 function WL_WARREPORT_COLLECT(fd, msg)
     local human = ObjHuman.onlineUuid[msg.uuid]
     if not human then return end
@@ -201,19 +205,20 @@ function WL_WARREPORT_COLLECT(fd, msg)
     WarReportLogic.collectHumanDo(human, msg.type, msg.id, msg.op)
 end
 
--- [战报] 点赞
+-- [战锟斤拷] 锟斤拷锟斤拷
 function LW_WARREPORT_ADMIRE(fd, msg)
     if not admire(msg.id, msg.uuid) then
        return
     end
 
-    local msgInner = InnerMsg.wl.WL_WARREPORT_ADMIRE
+    local msgInner = {} --InnerMsg.wl.WL_WARREPORT_ADMIRE
     msgInner.uuid = msg.uuid
     msgInner.id = msg.id
-    InnerMsg.sendMsg(fd, msgInner)
+    --InnerMsg.sendMsg(fd, msgInner)
+    WL_WARREPORT_ADMIRE(fd,msgInner)
 end 
 
--- [战报] 点赞
+-- [战锟斤拷] 锟斤拷锟斤拷
 function WL_WARREPORT_ADMIRE(fd, msg)
     local human = ObjHuman.onlineUuid[msg.uuid]
     if not human then return end
@@ -222,12 +227,12 @@ function WL_WARREPORT_ADMIRE(fd, msg)
 end 
 
 
--- 战报清除
+-- 战锟斤拷锟斤拷锟�
 local delQuery = {war = { ["$exists"] = 0}, war_index = { ["$exists"] = 0}, ["$or"] = {{collect = {["$exists"]=0}}, {collect = 0}}}
 function onZero()
    if _G.is_middle ~= true then 
       return 
    end
-   -- 0点清除 没有索引 且没有收藏的 数据
+   -- 0锟斤拷锟斤拷锟� 没锟斤拷锟斤拷锟斤拷 锟斤拷没锟斤拷锟秸藏碉拷 锟斤拷锟斤拷
    LuaMongo.remove(DB.db_war_report, delQuery)
 end