Commit b8d772331b13bff935cc6ae2a91ad60d961970f8
1 parent
c7991bb0
拆解周活动跨轮数据异常bug
Showing
2 changed files
with
45 additions
and
27 deletions
Show diff stats
src/models/Activity.lua
@@ -277,38 +277,56 @@ function Activity:checkWeeklyAct(actType, notify, count, pool) | @@ -277,38 +277,56 @@ function Activity:checkWeeklyAct(actType, notify, count, pool) | ||
277 | local totalCnt = 0 | 277 | local totalCnt = 0 |
278 | local finishCnt = 0 | 278 | local finishCnt = 0 |
279 | local maxCondition = 0 | 279 | local maxCondition = 0 |
280 | - for k, cfg in pairs(csvdb[info.table] or {}) do | ||
281 | - totalCnt = totalCnt + 1 | ||
282 | - if maxCondition < cfg.condition1 then | ||
283 | - maxCondition = cfg.condition1 | ||
284 | - end | ||
285 | - if not curData[cfg.id] and curData[0] >= cfg.condition1 then | ||
286 | - if info.mailId then | 280 | + local flag = true |
281 | + while flag do | ||
282 | + --print("tatal number :", curData[0]) | ||
283 | + for i = 1, #csvdb[info.table] do | ||
284 | + local cfg = csvdb[info.table][i] | ||
285 | + --for k, cfg in pairs(csvdb[info.table] or {}) do | ||
286 | + totalCnt = totalCnt + 1 | ||
287 | + if maxCondition < cfg.condition1 then | ||
288 | + maxCondition = cfg.condition1 | ||
289 | + end | ||
290 | + --print("cur condition", cfg.condition1) | ||
291 | + if curData[0] < cfg.condition1 then | ||
292 | + flag = false | ||
293 | + break | ||
294 | + end | ||
287 | 295 | ||
288 | - self.owner:log("activity", { | ||
289 | - activity_id = cfg.id, -- 活动ID(或活动指定任务的ID) | ||
290 | - activity_type = actType, -- 活动类型,见活动类型枚举表 | ||
291 | - activity_reward = cfg.reward:toNumMap(), -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...} | ||
292 | - }) | 296 | + --print(curData[0], cfg.condition1) |
297 | + if not curData[cfg.id] and curData[0] >= cfg.condition1 then | ||
298 | + if info.mailId then | ||
293 | 299 | ||
294 | - self.owner:sendMail(info.mailId, nil, cfg.reward, {cfg.condition1}) | ||
295 | - curData[cfg.id] = 1 | 300 | + self.owner:log("activity", { |
301 | + activity_id = cfg.id, -- 活动ID(或活动指定任务的ID) | ||
302 | + activity_type = actType, -- 活动类型,见活动类型枚举表 | ||
303 | + activity_reward = cfg.reward:toNumMap(), -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...} | ||
304 | + }) | ||
305 | + | ||
306 | + self.owner:sendMail(info.mailId, nil, cfg.reward, {cfg.condition1}) | ||
307 | + curData[cfg.id] = 1 | ||
308 | + end | ||
309 | + end | ||
310 | + if curData[cfg.id] then | ||
311 | + finishCnt = finishCnt + 1 | ||
296 | end | 312 | end |
297 | end | 313 | end |
298 | - if curData[cfg.id] then | ||
299 | - finishCnt = finishCnt + 1 | ||
300 | - end | ||
301 | - end | ||
302 | - if totalCnt == finishCnt then | ||
303 | - roundData[actType] = curRound + 1 | ||
304 | - for k,v in pairs(curData) do | ||
305 | - if k == 0 then | ||
306 | - curData[k] = curData[0] >= maxCondition and curData[0] - maxCondition or 0 | ||
307 | - else | ||
308 | - curData[k] = nil | 314 | + if totalCnt == finishCnt then |
315 | + roundData[actType] = (roundData[actType] or 0) + 1 | ||
316 | + for k,v in pairs(curData) do | ||
317 | + if k == 0 then | ||
318 | + curData[k] = curData[0] >= maxCondition and curData[0] - maxCondition or 0 | ||
319 | + else | ||
320 | + curData[k] = nil | ||
321 | + end | ||
322 | + end | ||
323 | + --print("cur round ".. roundData[actType], ctrlData.condition) | ||
324 | + if roundData[actType] >= ctrlData.condition then | ||
325 | + curData[0] = maxCondition | ||
326 | + flag = false | ||
309 | end | 327 | end |
328 | + self:updateProperty({field = "round", value = roundData, notNotify = not notify}) | ||
310 | end | 329 | end |
311 | - self:updateProperty({field = "round", value = roundData, notNotify = not notify}) | ||
312 | end | 330 | end |
313 | self:updateActData(actType, curData, not notify) | 331 | self:updateActData(actType, curData, not notify) |
314 | end | 332 | end |