go_dreamfactory/modules/martialhall/module.go
2022-11-24 14:10:04 +08:00

71 lines
1.8 KiB
Go

package martialhall
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/base"
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
)
/*
模块名:武馆
描述:练功房相关业务
开发:李伟
*/
func NewModule() core.IModule {
m := new(Martialhall)
return m
}
type Martialhall struct {
modules.ModuleBase
service base.IRPCXService //rpc服务对象 通过这个对象可以发布服务和调用其他服务的接口
api_comp *apiComp
configure *configureComp
modelMartialhall *modelMartialhall
}
//模块名
func (this *Martialhall) GetType() core.M_Modules {
return comm.ModuleMartialhall
}
//模块初始化接口 注册用户创建角色事件
func (this *Martialhall) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
err = this.ModuleBase.Init(service, module, options)
this.service = service.(base.IRPCXService)
return
}
func (this *Martialhall) Start() (err error) {
err = this.ModuleBase.Start()
return
}
//装备组件
func (this *Martialhall) OnInstallComp() {
this.ModuleBase.OnInstallComp()
this.api_comp = this.RegisterComp(new(apiComp)).(*apiComp)
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
this.modelMartialhall = this.RegisterComp(new(modelMartialhall)).(*modelMartialhall)
}
//红点查询
func (this *Martialhall) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (reddot map[comm.ReddotType]bool) {
reddot = make(map[comm.ReddotType]bool)
for _, v := range rid {
switch v {
case comm.Reddot23:
reddot[comm.Reddot23] = this.modelMartialhall.checkReddot23(session)
break
case comm.Reddot24:
reddot[comm.Reddot24] = this.modelMartialhall.checkReddot24(session)
break
case comm.Reddot25:
reddot[comm.Reddot25] = this.modelMartialhall.checkReddot25(session)
break
}
}
return
}