diff --git a/comm/imodule.go b/comm/imodule.go index 5fc8736e7..e70598963 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -536,4 +536,8 @@ type ( //英雄升级 HeroUpLv(uid string, heroid string, lv int32) } + // 世界任务 + IWtask interface { + IOpenCmdNotice + } ) diff --git a/comm/usersession.go b/comm/usersession.go index 250471f27..c97d7a5dd 100644 --- a/comm/usersession.go +++ b/comm/usersession.go @@ -157,6 +157,12 @@ func (this *UserSession) Push() (err error) { return } +// 克隆 +func (this *UserSession) Clone() (clone *UserSession) { + + return +} + // 打印日志需要 func (this *UserSession) ToString() string { return fmt.Sprintf("SessionId:%s UserId:%s GatewayServiceId:%s", this.SessionId, this.UserId, this.GatewayServiceId) diff --git a/modules/sys/api_activate.go b/modules/sys/api_activate.go index ae5b9bbc7..a7b0cb4d6 100644 --- a/modules/sys/api_activate.go +++ b/modules/sys/api_activate.go @@ -48,6 +48,7 @@ func (this *apiComp) FuncActivate(session comm.IUserSession, req *pb.SysFuncActi return } + go this.module.wtask.OpenCmdNotice(session.GetUserId(), req.Cid) //手动激活通知模块 for _, m := range opencfg.Notify { i, err := this.service.GetModule(core.M_Modules(m)) diff --git a/modules/sys/api_getlist.go b/modules/sys/api_getlist.go index 20f50b71b..4fc0f55d2 100644 --- a/modules/sys/api_getlist.go +++ b/modules/sys/api_getlist.go @@ -13,6 +13,7 @@ func (this *apiComp) FuncGetList(session comm.IUserSession, req *pb.SysFuncGetLi var ( bChange bool + change []string = make([]string, 0) ) rsp := &pb.SysFuncGetListResp{} rsp.Cond = make(map[string]int32, 0) @@ -34,6 +35,7 @@ func (this *apiComp) FuncGetList(session comm.IUserSession, req *pb.SysFuncGetLi list.Cond[id] = 1 //设置激活 } else { list.Cond[id] = 2 //自动激活 + change = append(change, id) } bChange = true } @@ -50,6 +52,7 @@ func (this *apiComp) FuncGetList(session comm.IUserSession, req *pb.SysFuncGetLi list.Cond[id] = 1 //设置激活 } else { list.Cond[id] = 2 //自动激活 + change = append(change, id) } bChange = true } @@ -64,6 +67,9 @@ func (this *apiComp) FuncGetList(session comm.IUserSession, req *pb.SysFuncGetLi "cond": list.Cond, }) } + if len(change) > 0 { + go this.module.wtask.OpenCmdNotice(session.GetUserId(), change...) + } session.SendMsg(string(this.module.GetType()), "funcgetlist", rsp) return } diff --git a/modules/sys/module.go b/modules/sys/module.go index 913094ae0..d539bd688 100644 --- a/modules/sys/module.go +++ b/modules/sys/module.go @@ -16,6 +16,7 @@ var _ comm.ISys = (*ModuleSys)(nil) type ModuleSys struct { modules.ModuleBase + wtask comm.IWtask api *apiComp configure *configureComp service base.IRPCXService @@ -33,7 +34,7 @@ func (this *ModuleSys) OnInstallComp() { this.configure = this.RegisterComp(new(configureComp)).(*configureComp) } -//模块初始化 +// 模块初始化 func (this *ModuleSys) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) { err = this.ModuleBase.Init(service, module, options) this.service = service.(base.IRPCXService) @@ -43,6 +44,11 @@ func (this *ModuleSys) Init(service core.IService, module core.IModule, options func (this *ModuleSys) Start() (err error) { err = this.ModuleBase.Start() + var module core.IModule + if module, err = this.service.GetModule(comm.ModuleSys); err != nil { + return + } + this.wtask = module.(comm.IWtask) this.service.RegisterFunctionName(string(comm.Rpc_OpendCond), this.OpenCond) return }