商队结算
This commit is contained in:
parent
92f2aaeea2
commit
c5e09f3281
@ -2,10 +2,12 @@ package timer
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"fmt"
|
||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
"go_dreamfactory/lego/base"
|
"go_dreamfactory/lego/base"
|
||||||
"go_dreamfactory/lego/core"
|
"go_dreamfactory/lego/core"
|
||||||
"go_dreamfactory/lego/core/cbase"
|
"go_dreamfactory/lego/core/cbase"
|
||||||
|
"go_dreamfactory/lego/sys/cron"
|
||||||
"go_dreamfactory/lego/sys/log"
|
"go_dreamfactory/lego/sys/log"
|
||||||
"go_dreamfactory/lego/sys/timewheel"
|
"go_dreamfactory/lego/sys/timewheel"
|
||||||
"go_dreamfactory/modules"
|
"go_dreamfactory/modules"
|
||||||
@ -68,26 +70,22 @@ 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()
|
||||||
|
|
||||||
//cron.AddFunc("30 10 1 * * ?", this.TimerSeason)
|
|
||||||
//seasonTime := this.GetGlobalConf().BusinessRewardday * 24 * 3600
|
|
||||||
|
|
||||||
if configure.Now().Unix() < opentime { // 开服时间是未来可能存在问题
|
if configure.Now().Unix() < opentime { // 开服时间是未来可能存在问题
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// subTime := int32(configure.Now().Unix() - opentime)
|
//获取时分秒
|
||||||
// if subTime < seasonTime {
|
currentTime := time.Unix(opentime, 0)
|
||||||
// this.cTimerObj = timewheel.Add(time.Second*time.Duration(subTime), this.TimerSeason, nil)
|
m := currentTime.Minute()
|
||||||
// } else {
|
s := currentTime.Second()
|
||||||
// s := configure.Now().Unix() - (configure.Now().Unix()-opentime)%int64(subTime) + int64(seasonTime)
|
day := this.GetGlobalConf().BusinessRewardday
|
||||||
// this.cTimerObj = timewheel.Add(time.Second*time.Duration(s), this.TimerSeason, nil)
|
cronStr := fmt.Sprintf("%d %d */%d * * ?", m, s, day) // 每天的
|
||||||
// }
|
cron.AddFunc(cronStr, this.TimerSeason)
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *CaravanRank) TimerSeason(task *timewheel.Task, args ...interface{}) {
|
func (this *CaravanRank) TimerSeason() {
|
||||||
this.module.Debugf("==%d", time.Now().Unix())
|
|
||||||
if _, err := this.service.RpcGo(context.Background(),
|
if _, err := this.service.RpcGo(context.Background(),
|
||||||
comm.Service_Worker,
|
comm.Service_Worker,
|
||||||
string(comm.Rpc_ModuleCaravanSettlement),
|
string(comm.Rpc_ModuleCaravanSettlement),
|
||||||
@ -96,9 +94,5 @@ func (this *CaravanRank) TimerSeason(task *timewheel.Task, args ...interface{})
|
|||||||
); err != nil {
|
); err != nil {
|
||||||
this.module.Errorln(err)
|
this.module.Errorln(err)
|
||||||
}
|
}
|
||||||
if this.cTimerObj != nil {
|
|
||||||
timewheel.Remove(this.cTimerObj)
|
|
||||||
} // 重新开启一个时间轮
|
|
||||||
this.cTimerObj = timewheel.Add(time.Second*time.Duration(this.GetGlobalConf().BusinessRewardday), this.TimerSeason, nil)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user