更新配置
This commit is contained in:
parent
b95ce261d4
commit
621f50bff3
@ -37,6 +37,15 @@ func (this *configureComp) getOpencondCfg() (data *cfg.GameOpencond, err error)
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *configureComp) getFuncCfg(funcName string) (data *cfg.GameOpencondData) {
|
||||||
|
if cfg, err := this.getOpencondCfg(); err != nil {
|
||||||
|
return nil
|
||||||
|
} else {
|
||||||
|
data = cfg.GetDataMap()[funcName]
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func (this *configureComp) getOpencondList() (list []*cfg.GameOpencondData) {
|
func (this *configureComp) getOpencondList() (list []*cfg.GameOpencondData) {
|
||||||
if cfg, err := this.getOpencondCfg(); err != nil {
|
if cfg, err := this.getOpencondCfg(); err != nil {
|
||||||
return nil
|
return nil
|
||||||
|
30
modules/sys/model_sys.go
Normal file
30
modules/sys/model_sys.go
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
package sys
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go_dreamfactory/comm"
|
||||||
|
"go_dreamfactory/lego/core"
|
||||||
|
"go_dreamfactory/modules"
|
||||||
|
)
|
||||||
|
|
||||||
|
type ModelSys struct {
|
||||||
|
modules.MCompModel
|
||||||
|
moduleSys *ModuleSys
|
||||||
|
service core.IService
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *ModelSys) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
||||||
|
this.TableName = comm.TableSys
|
||||||
|
err = this.MCompModel.Init(service, module, comp, options)
|
||||||
|
this.moduleSys = module.(*ModuleSys)
|
||||||
|
this.service = service
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 是否允许访问功能,条件:玩家等级
|
||||||
|
func (this *ModelSys) IsAccess(funName string, userLv int32) bool {
|
||||||
|
conf := this.moduleSys.configure.getFuncCfg(funName)
|
||||||
|
if conf != nil {
|
||||||
|
return userLv >= conf.Main
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
@ -6,10 +6,14 @@ import (
|
|||||||
"go_dreamfactory/modules"
|
"go_dreamfactory/modules"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var _ comm.ISys = (*ModuleSys)(nil)
|
||||||
|
|
||||||
type ModuleSys struct {
|
type ModuleSys struct {
|
||||||
modules.ModuleBase
|
modules.ModuleBase
|
||||||
api *apiComp
|
api *apiComp
|
||||||
configure *configureComp
|
configure *configureComp
|
||||||
|
|
||||||
|
modelSys *ModelSys
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewModule() core.IModule {
|
func NewModule() core.IModule {
|
||||||
@ -19,9 +23,14 @@ func NewModule() core.IModule {
|
|||||||
func (this *ModuleSys) OnInstallComp() {
|
func (this *ModuleSys) OnInstallComp() {
|
||||||
this.ModuleBase.OnInstallComp()
|
this.ModuleBase.OnInstallComp()
|
||||||
this.api = this.RegisterComp(new(apiComp)).(*apiComp)
|
this.api = this.RegisterComp(new(apiComp)).(*apiComp)
|
||||||
|
this.modelSys = this.RegisterComp(new(ModelSys)).(*ModelSys)
|
||||||
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
|
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *ModuleSys) GetType() core.M_Modules {
|
func (this *ModuleSys) GetType() core.M_Modules {
|
||||||
return comm.ModuleSys
|
return comm.ModuleSys
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *ModuleSys) IsAccess(funcName string, userLv int32) bool {
|
||||||
|
return this.modelSys.IsAccess(funcName, userLv)
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user