go_dreamfactory/modules/plunder/module.go

58 lines
1.3 KiB
Go

package plunder
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
)
func NewModule() core.IModule {
m := new(Plunder)
return m
}
/*
模块名称:猜颜色
*/
type Plunder struct {
modules.ModuleBase
service comm.IService
api *apiComp
configure *configureComp
modelPlunder *modelPlunder
modelLand *modelLand
}
// 模块名
func (this *Plunder) GetType() core.M_Modules {
return comm.ModulePlunder
}
// 模块初始化接口
func (this *Plunder) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
err = this.ModuleBase.Init(service, module, options)
this.service = service.(comm.IService)
return
}
func (this *Plunder) Start() (err error) {
if err = this.ModuleBase.Start(); err != nil {
return
}
return
}
func (this *Plunder) OnInstallComp() {
this.ModuleBase.OnInstallComp()
this.api = this.RegisterComp(new(apiComp)).(*apiComp)
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
this.modelPlunder = this.RegisterComp(new(modelPlunder)).(*modelPlunder)
this.modelLand = this.RegisterComp(new(modelLand)).(*modelLand)
}
func (this *Plunder) CreatePlunderLand(uid string) (land *pb.DBPlunderLand, err error) {
return this.modelLand.createPlunderLandData(uid)
}