go_dreamfactory/modules/sys/module.go
2022-12-27 14:39:03 +08:00

50 lines
1.1 KiB
Go

package sys
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/event"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
)
var _ comm.ISys = (*ModuleSys)(nil)
type ModuleSys struct {
modules.ModuleBase
api *apiComp
configure *configureComp
modelSys *ModelSys
}
func NewModule() core.IModule {
return &ModuleSys{}
}
func (this *ModuleSys) OnInstallComp() {
this.ModuleBase.OnInstallComp()
this.api = this.RegisterComp(new(apiComp)).(*apiComp)
this.modelSys = this.RegisterComp(new(ModelSys)).(*ModelSys)
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
}
func (this *ModuleSys) Start() (err error) {
err = this.ModuleBase.Start()
event.RegisterGO(comm.EventOpenCond, this.EventOpenCond)
return
}
func (this *ModuleSys) GetType() core.M_Modules {
return comm.ModuleSys
}
func (this *ModuleSys) IsAccess(funcName string, userId string) (code pb.ErrorCode) {
return this.modelSys.IsAccess(funcName, userId)
}
func (this *ModuleSys) EventOpenCond(funcIds []string) {
this.Debug("EventOpenCond", log.Field{Key: "funcIds", Value: funcIds})
}