diff --git a/modules/viking/module.go b/modules/viking/module.go index f6e0c5294..6cc725cd2 100644 --- a/modules/viking/module.go +++ b/modules/viking/module.go @@ -83,7 +83,7 @@ func (this *Viking) Start() (err error) { } this.battle = module.(comm.IBattle) - + this.CheckCurSeasonData() return } @@ -234,11 +234,13 @@ func (this *Viking) CompleteAllLevel(session comm.IUserSession) (errdata *pb.Err // 检查当前赛季是在本服还是在跨服 func (this *Viking) CheckCurSeasonData() (bLocal bool, endSeasonTime int64) { + var subTime int64 + var oneSeason int64 openTime := this.service.GetOpentime().Unix() this.Debugf("%d", openTime) // 获取第一个赛季结束的时间 - endSeasonTime = utils.GetTodayZeroTime(openTime) //+ int64((6-d)*3600*24) - this.Debugf("%d", endSeasonTime) + oneSeason = utils.GetTodayZeroTime(openTime) //+ int64((6-d)*3600*24) + this.Debugf("%d", oneSeason) var c int32 if Continued%Cycle == 0 { @@ -247,11 +249,18 @@ func (this *Viking) CheckCurSeasonData() (bLocal bool, endSeasonTime int64) { c = Continued/Cycle + 1 } + if configure.Now().Unix() > oneSeason { + subTime = configure.Now().Unix() - oneSeason + subTime = subTime/(14*3600*24) + 1 + } // 只需判断当前时间是否大于第c个赛季即可 + endSeasonTime = oneSeason endSeasonTime += 14 * 3600 * 24 * int64(c) if endSeasonTime <= configure.Now().Unix() { + endSeasonTime = oneSeason + subTime*14*3600*24 return false, endSeasonTime } + endSeasonTime = oneSeason + subTime*14*3600*24 return true, endSeasonTime }