43 lines
931 B
Go
43 lines
931 B
Go
package user
|
|
|
|
import (
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/modules"
|
|
|
|
"go_dreamfactory/lego/base"
|
|
"go_dreamfactory/lego/core"
|
|
)
|
|
|
|
const (
|
|
UserSubTypeLogin = "login"
|
|
UserSubTypeLogout = "logout"
|
|
UserSubTypeCreate = "create"
|
|
UserSubTypeAddRes = "addres" //添加用户资源 金币、宝石等
|
|
)
|
|
|
|
type apiComp struct {
|
|
modules.MCompGate
|
|
service base.IRPCXService
|
|
module *User
|
|
hero comm.IHero
|
|
}
|
|
|
|
func (this *apiComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
|
this.MCompGate.Init(service, module, comp, options)
|
|
this.service = service.(base.IRPCXService)
|
|
this.module = module.(*User)
|
|
return
|
|
}
|
|
|
|
func (this *apiComp) Start() (err error) {
|
|
err = this.MCompGate.Start()
|
|
var module core.IModule
|
|
|
|
//get module hero
|
|
if module, err = this.service.GetModule(comm.ModuleHero); err != nil {
|
|
return
|
|
}
|
|
this.hero = module.(comm.IHero)
|
|
return
|
|
}
|