From b8d772331b13bff935cc6ae2a91ad60d961970f8 Mon Sep 17 00:00:00 2001 From: liuzujun <307836273@qq.com> Date: Wed, 6 Jan 2021 21:03:42 +0800 Subject: [PATCH] 拆解周活动跨轮数据异常bug --- src/csvdata | 2 +- src/models/Activity.lua | 70 ++++++++++++++++++++++++++++++++++++++++++++-------------------------- 2 files changed, 45 insertions(+), 27 deletions(-) diff --git a/src/csvdata b/src/csvdata index ccdf6fc..fc11cc4 160000 --- a/src/csvdata +++ b/src/csvdata @@ -1 +1 @@ -Subproject commit ccdf6fcc82fd0a38d1b00bc199baadfd81ec3ab1 +Subproject commit fc11cc4a7ae4881df79ae2ffc6c09d50df33bf51 diff --git a/src/models/Activity.lua b/src/models/Activity.lua index 83d2231..13423c2 100644 --- a/src/models/Activity.lua +++ b/src/models/Activity.lua @@ -277,38 +277,56 @@ function Activity:checkWeeklyAct(actType, notify, count, pool) local totalCnt = 0 local finishCnt = 0 local maxCondition = 0 - for k, cfg in pairs(csvdb[info.table] or {}) do - totalCnt = totalCnt + 1 - if maxCondition < cfg.condition1 then - maxCondition = cfg.condition1 - end - if not curData[cfg.id] and curData[0] >= cfg.condition1 then - if info.mailId then + local flag = true + while flag do + --print("tatal number :", curData[0]) + for i = 1, #csvdb[info.table] do + local cfg = csvdb[info.table][i] + --for k, cfg in pairs(csvdb[info.table] or {}) do + totalCnt = totalCnt + 1 + if maxCondition < cfg.condition1 then + maxCondition = cfg.condition1 + end + --print("cur condition", cfg.condition1) + if curData[0] < cfg.condition1 then + flag = false + break + end - self.owner:log("activity", { - activity_id = cfg.id, -- 活动ID(或活动指定任务的ID) - activity_type = actType, -- 活动类型,见活动类型枚举表 - activity_reward = cfg.reward:toNumMap(), -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...} - }) + --print(curData[0], cfg.condition1) + if not curData[cfg.id] and curData[0] >= cfg.condition1 then + if info.mailId then - self.owner:sendMail(info.mailId, nil, cfg.reward, {cfg.condition1}) - curData[cfg.id] = 1 + self.owner:log("activity", { + activity_id = cfg.id, -- 活动ID(或活动指定任务的ID) + activity_type = actType, -- 活动类型,见活动类型枚举表 + activity_reward = cfg.reward:toNumMap(), -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...} + }) + + self.owner:sendMail(info.mailId, nil, cfg.reward, {cfg.condition1}) + curData[cfg.id] = 1 + end + end + if curData[cfg.id] then + finishCnt = finishCnt + 1 end end - if curData[cfg.id] then - finishCnt = finishCnt + 1 - end - end - if totalCnt == finishCnt then - roundData[actType] = curRound + 1 - for k,v in pairs(curData) do - if k == 0 then - curData[k] = curData[0] >= maxCondition and curData[0] - maxCondition or 0 - else - curData[k] = nil + if totalCnt == finishCnt then + roundData[actType] = (roundData[actType] or 0) + 1 + for k,v in pairs(curData) do + if k == 0 then + curData[k] = curData[0] >= maxCondition and curData[0] - maxCondition or 0 + else + curData[k] = nil + end + end + --print("cur round ".. roundData[actType], ctrlData.condition) + if roundData[actType] >= ctrlData.condition then + curData[0] = maxCondition + flag = false end + self:updateProperty({field = "round", value = roundData, notNotify = not notify}) end - self:updateProperty({field = "round", value = roundData, notNotify = not notify}) end self:updateActData(actType, curData, not notify) end -- libgit2 0.21.2