update
This commit is contained in:
parent
b7f5b20b1a
commit
e24b610db9
@ -68,21 +68,20 @@ func (this *CaravanRank) GetGlobalConf() *cfg.GameGlobalData {
|
|||||||
func (this *CaravanRank) Start() (err error) {
|
func (this *CaravanRank) Start() (err error) {
|
||||||
err = this.MCompModel.Start()
|
err = this.MCompModel.Start()
|
||||||
opentime := this.service.GetOpentime().Unix()
|
opentime := this.service.GetOpentime().Unix()
|
||||||
this.module.Debugf("%d", opentime)
|
|
||||||
//cron.AddFunc("30 10 1 * * ?", this.TimerSeason)
|
//cron.AddFunc("30 10 1 * * ?", this.TimerSeason)
|
||||||
this.module.Debugf("--%d", time.Now().Unix())
|
//seasonTime := this.GetGlobalConf().BusinessRewardday * 24 * 3600
|
||||||
seasonTime := this.GetGlobalConf().BusinessRewardday
|
|
||||||
|
|
||||||
if configure.Now().Unix() < opentime { // 开服时间是未来可能存在问题
|
if configure.Now().Unix() < opentime { // 开服时间是未来可能存在问题
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
subTime := int32(configure.Now().Unix() - opentime)
|
// subTime := int32(configure.Now().Unix() - opentime)
|
||||||
if subTime < seasonTime {
|
// if subTime < seasonTime {
|
||||||
this.cTimerObj = timewheel.Add(time.Second*time.Duration(subTime), this.TimerSeason, nil)
|
// this.cTimerObj = timewheel.Add(time.Second*time.Duration(subTime), this.TimerSeason, nil)
|
||||||
} else {
|
// } else {
|
||||||
s := configure.Now().Unix() - (configure.Now().Unix()-opentime)%int64(subTime) + int64(seasonTime)
|
// s := configure.Now().Unix() - (configure.Now().Unix()-opentime)%int64(subTime) + int64(seasonTime)
|
||||||
this.cTimerObj = timewheel.Add(time.Second*time.Duration(s), this.TimerSeason, nil)
|
// this.cTimerObj = timewheel.Add(time.Second*time.Duration(s), this.TimerSeason, nil)
|
||||||
}
|
// }
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -8,14 +8,12 @@ import (
|
|||||||
"go_dreamfactory/modules/web"
|
"go_dreamfactory/modules/web"
|
||||||
"go_dreamfactory/services"
|
"go_dreamfactory/services"
|
||||||
"go_dreamfactory/sys/db"
|
"go_dreamfactory/sys/db"
|
||||||
"time"
|
|
||||||
|
|
||||||
"go_dreamfactory/lego"
|
"go_dreamfactory/lego"
|
||||||
"go_dreamfactory/lego/base/rpcx"
|
"go_dreamfactory/lego/base/rpcx"
|
||||||
"go_dreamfactory/lego/core"
|
"go_dreamfactory/lego/core"
|
||||||
"go_dreamfactory/lego/sys/cron"
|
"go_dreamfactory/lego/sys/cron"
|
||||||
"go_dreamfactory/lego/sys/log"
|
"go_dreamfactory/lego/sys/log"
|
||||||
"go_dreamfactory/lego/sys/timewheel"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -65,11 +63,11 @@ func (this *Service) InitSys() {
|
|||||||
log.Infof("init sys.cron success!")
|
log.Infof("init sys.cron success!")
|
||||||
}
|
}
|
||||||
//定时系统 秒级时间轮
|
//定时系统 秒级时间轮
|
||||||
if err := timewheel.OnInit(nil, timewheel.SetTick(time.Second)); err != nil {
|
// if err := timewheel.OnInit(nil, timewheel.SetTick(time.Second)); err != nil {
|
||||||
panic(fmt.Sprintf("init sys.timewheel err: %s", err.Error()))
|
// panic(fmt.Sprintf("init sys.timewheel err: %s", err.Error()))
|
||||||
} else {
|
// } else {
|
||||||
log.Infof("init sys.timewheel success!")
|
// log.Infof("init sys.timewheel success!")
|
||||||
}
|
// }
|
||||||
//存储系统
|
//存储系统
|
||||||
if err := db.OnInit(this.GetSettings().Sys["db"]); err != nil {
|
if err := db.OnInit(this.GetSettings().Sys["db"]); err != nil {
|
||||||
panic(fmt.Sprintf("init sys.db err: %s", err.Error()))
|
panic(fmt.Sprintf("init sys.db err: %s", err.Error()))
|
||||||
|
Loading…
Reference in New Issue
Block a user