Commit 8a57b6031347b6d633e2c637ce96f0365fc79015

Authored by zhouhaihai
1 parent ead2c938

初始化冒险重置时间

Showing 2 changed files with 8 additions and 1 deletions   Show diff stats
src/models/Role.lua
... ... @@ -29,6 +29,13 @@ function Role:ctor( properties )
29 29 self.activity = nil
30 30 self.advElChapter = tonum(redisproxy:hget("adv_season", "chapter"), globalCsv.adv_endless_default_chapter) -- 无尽模式记录的赛季对应章节
31 31 self.advOverTime = tonum(redisproxy:hget("adv_season", "overTime")) -- 无尽模式关闭时间戳
  32 + if self.advOverTime == 0 then
  33 + local now = skynet.timex()
  34 + if math.floor(now / (3600 * 24 * 7)) % 2 == 1 then
  35 + self.advOverTime = 3600 * 24 * 7
  36 + end
  37 + self.advOverTime = self.advOverTime + specMonday(now) + 3600 * 24 * 6
  38 + end
32 39 self.sendMailFlag = false --发送邮件标识
33 40 end
34 41  
... ...
src/utils/CommonFunc.lua
... ... @@ -219,7 +219,7 @@ function specMonday(now)
219 219 local wday = (tm.wday + 6) % 7
220 220 if wday == 0 then wday = 7 end
221 221  
222   - local time = os.time({year = tm.year, month = tm.month, day = tm.day})
  222 + local time = os.time({year = tm.year, month = tm.month, day = tm.day, hour = RESET_TIME})
223 223 return time - (wday - 1) * 86400
224 224 end
225 225  
... ...