package shop import ( "go_dreamfactory/comm" "go_dreamfactory/lego/base" "go_dreamfactory/lego/core" "go_dreamfactory/modules" "go_dreamfactory/sys/db" ) /* 模块名:商店 描述:商城相关业务 开发:李伟 */ func NewModule() core.IModule { m := new(Shop) return m } type Shop struct { modules.ModuleBase service base.IRPCXService equip comm.IEquipment //装备系统 privilege comm.IPrivilege api_comp *apiComp configure *configureComp modelShop *modelShopComp } //模块名 func (this *Shop) GetType() core.M_Modules { return comm.ModuleShop } //模块初始化接口 注册用户创建角色事件 func (this *Shop) 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 *Shop) Start() (err error) { err = this.ModuleBase.Start() var module core.IModule if module, err = this.service.GetModule(comm.ModuleEquipment); err != nil { return } this.equip = module.(comm.IEquipment) if module, err = this.service.GetModule(comm.ModulePrivilege); err != nil { return } this.privilege = module.(comm.IPrivilege) return } //装备组件 func (this *Shop) OnInstallComp() { this.ModuleBase.OnInstallComp() this.api_comp = this.RegisterComp(new(apiComp)).(*apiComp) this.modelShop = this.RegisterComp(new(modelShopComp)).(*modelShopComp) this.configure = this.RegisterComp(new(configureComp)).(*configureComp) } //Event------------------------------------------------------------------------------------------------------------ func (this *Shop) EventUserOffline(session comm.IUserSession) { this.modelShop.DelByUId(session.GetUserId(), db.SetDBMgoLog(false)) }