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