Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
12d495ef7d
@ -394,6 +394,9 @@ const ( //Rpc
|
|||||||
Rpc_ModuleWarorderSettlement core.Rpc_Key = "Rpc_ModuleWarorderSettlement"
|
Rpc_ModuleWarorderSettlement core.Rpc_Key = "Rpc_ModuleWarorderSettlement"
|
||||||
//工会boos战结算 事件
|
//工会boos战结算 事件
|
||||||
Rpc_ModuleGuildBossSettlement core.Rpc_Key = "Rpc_ModuleGuildBossSettlement"
|
Rpc_ModuleGuildBossSettlement core.Rpc_Key = "Rpc_ModuleGuildBossSettlement"
|
||||||
|
|
||||||
|
// 石阵秘境结算
|
||||||
|
Rpc_ModuleStoneBossSettlement core.Rpc_Key = "Rpc_ModuleStoneBossSettlement"
|
||||||
)
|
)
|
||||||
|
|
||||||
// 事件类型定义处
|
// 事件类型定义处
|
||||||
|
@ -8,6 +8,7 @@ import (
|
|||||||
"go_dreamfactory/lego/sys/cron"
|
"go_dreamfactory/lego/sys/cron"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// "0 0 1 ? * 1"
|
||||||
// 1. cron表达式格式:
|
// 1. cron表达式格式:
|
||||||
// {秒数} {分钟} {小时} {日期} {月份} {星期} {年份(可为空)}
|
// {秒数} {分钟} {小时} {日期} {月份} {星期} {年份(可为空)}
|
||||||
// 2. cron表达式各占位符解释:
|
// 2. cron表达式各占位符解释:
|
||||||
|
@ -7,7 +7,6 @@ import (
|
|||||||
"go_dreamfactory/lego/sys/mgo"
|
"go_dreamfactory/lego/sys/mgo"
|
||||||
"go_dreamfactory/modules"
|
"go_dreamfactory/modules"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
"go_dreamfactory/sys/configure"
|
|
||||||
"go_dreamfactory/utils"
|
"go_dreamfactory/utils"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
@ -45,7 +44,7 @@ func (this *MStonehenge) Start() (err error) {
|
|||||||
err = this.MCompModel.Start()
|
err = this.MCompModel.Start()
|
||||||
|
|
||||||
event.RegisterGO(core.Event_ServiceStartEnd, func() {
|
event.RegisterGO(core.Event_ServiceStartEnd, func() {
|
||||||
err = this.loadStoneBoos()
|
err = this.reLoadStoneBoos()
|
||||||
})
|
})
|
||||||
|
|
||||||
return
|
return
|
||||||
@ -62,7 +61,7 @@ func (this *MStonehenge) GetStonehengeData(uid string) *pb.DBStonehenge {
|
|||||||
stone.Addweight = make(map[int32]int32, 0)
|
stone.Addweight = make(map[int32]int32, 0)
|
||||||
stone.Etime = utils.WeekIntervalTime(0)
|
stone.Etime = utils.WeekIntervalTime(0)
|
||||||
this.Add(uid, stone)
|
this.Add(uid, stone)
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
return stone
|
return stone
|
||||||
}
|
}
|
||||||
@ -73,7 +72,7 @@ func (this *MStonehenge) ChangeStonehengeData(uid string, update map[string]inte
|
|||||||
return this.Change(uid, update)
|
return this.Change(uid, update)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *MStonehenge) loadStoneBoos() (err error) {
|
func (this *MStonehenge) reLoadStoneBoos() (err error) {
|
||||||
|
|
||||||
s := &pb.DBStoneBoss{}
|
s := &pb.DBStoneBoss{}
|
||||||
this.module.ModuleTools.GetGlobalData(StoneBossKey, s)
|
this.module.ModuleTools.GetGlobalData(StoneBossKey, s)
|
||||||
@ -83,7 +82,7 @@ func (this *MStonehenge) loadStoneBoos() (err error) {
|
|||||||
this.lock.Unlock()
|
this.lock.Unlock()
|
||||||
this.module.ModuleTools.UpdateGlobalData(StoneBossKey, map[string]interface{}{
|
this.module.ModuleTools.UpdateGlobalData(StoneBossKey, map[string]interface{}{
|
||||||
"BossStage": this.bossStage,
|
"BossStage": this.bossStage,
|
||||||
"rtime": configure.Now().Unix(),
|
"rtime": utils.WeekIntervalTime(0),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
package stonehenge
|
package stonehenge
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
"go_dreamfactory/lego/base"
|
"go_dreamfactory/lego/base"
|
||||||
"go_dreamfactory/lego/core"
|
"go_dreamfactory/lego/core"
|
||||||
"go_dreamfactory/modules"
|
"go_dreamfactory/modules"
|
||||||
|
"go_dreamfactory/pb"
|
||||||
)
|
)
|
||||||
|
|
||||||
const moduleName = "石阵秘境"
|
const moduleName = "石阵秘境"
|
||||||
@ -42,7 +44,7 @@ func (this *Stonehenge) Start() (err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.battle = module.(comm.IBattle)
|
this.battle = module.(comm.IBattle)
|
||||||
|
this.service.RegisterFunctionName(string(comm.Rpc_ModuleStoneBossSettlement), this.Rpc_ModuleStoneBossSettlement)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,3 +55,10 @@ func (this *Stonehenge) OnInstallComp() {
|
|||||||
this.modelStonehenge = this.RegisterComp(new(MStonehenge)).(*MStonehenge)
|
this.modelStonehenge = this.RegisterComp(new(MStonehenge)).(*MStonehenge)
|
||||||
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
|
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 工会Boos战结算通知
|
||||||
|
func (this *Stonehenge) Rpc_ModuleStoneBossSettlement(ctx context.Context, req *pb.EmptyReq, resp interface{}) (err error) {
|
||||||
|
this.Debug("Rpc_ModuleStoneBossSettlement 石阵秘境Boos结算通知 !")
|
||||||
|
this.modelStonehenge.reLoadStoneBoos()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
48
modules/timer/stoneboss.go
Normal file
48
modules/timer/stoneboss.go
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
package timer
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"go_dreamfactory/comm"
|
||||||
|
"go_dreamfactory/modules"
|
||||||
|
"go_dreamfactory/pb"
|
||||||
|
"go_dreamfactory/sys/db"
|
||||||
|
|
||||||
|
"go_dreamfactory/lego/base"
|
||||||
|
"go_dreamfactory/lego/core"
|
||||||
|
"go_dreamfactory/lego/sys/cron"
|
||||||
|
)
|
||||||
|
|
||||||
|
type StoneComp struct {
|
||||||
|
modules.MCompConfigure
|
||||||
|
service base.IRPCXService
|
||||||
|
module *Timer
|
||||||
|
}
|
||||||
|
|
||||||
|
// 组件初始化接口
|
||||||
|
func (this *StoneComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
||||||
|
this.MCompConfigure.Init(service, module, comp, options)
|
||||||
|
this.service = service.(base.IRPCXService)
|
||||||
|
this.module = module.(*Timer)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *StoneComp) Start() (err error) {
|
||||||
|
err = this.MCompConfigure.Start()
|
||||||
|
if !db.IsCross() {
|
||||||
|
if _, err = cron.AddFunc("5 0 1 ? * 1", this.timer); err != nil { // 每周一1点触发
|
||||||
|
this.module.Errorf("cron.AddFunc err:%v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *StoneComp) timer() {
|
||||||
|
if _, err := this.service.RpcGo(context.Background(),
|
||||||
|
comm.Service_Worker,
|
||||||
|
string(comm.Rpc_ModuleStoneBossSettlement),
|
||||||
|
pb.EmptyReq{},
|
||||||
|
nil,
|
||||||
|
); err != nil {
|
||||||
|
this.module.Errorln(err)
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user