go_dreamfactory/modules/privilege/module.go
2022-11-04 15:22:13 +08:00

45 lines
1.2 KiB
Go

package privilege
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
"go_dreamfactory/sys/db"
)
func NewModule() core.IModule {
m := new(Privilege)
return m
}
type Privilege struct {
modules.ModuleBase
api_comp *apiComp
configure *configureComp
modelShop *modelShopComp
}
//模块名
func (this *Privilege) GetType() core.M_Modules {
return comm.ModuleShop
}
//模块初始化接口 注册用户创建角色事件
func (this *Privilege) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
err = this.ModuleBase.Init(service, module, options)
return
}
//装备组件
func (this *Privilege) 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 *Privilege) EventUserOffline(session comm.IUserSession) {
this.modelShop.DelByUId(session.GetUserId(), db.SetDBMgoLog(false))
}