diff --git a/comm/imodule.go b/comm/imodule.go index 3df98f164..d9f929d38 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -35,6 +35,8 @@ type ( CheckLvUpCond(session IUserSession, lv int32) CheckTaskCond(session IUserSession, id int32) CheckMlineCond(session IUserSession, id int32) + // 查询opencond 配置 + GetOpenCondCfgById(id string) (data *cfg.GameOpencondData, err error) } //邮件业务模块对外接口定义 提供给其他模块使用的 diff --git a/modules/sys/config.go b/modules/sys/config.go index a3c4bde4d..c461793c0 100644 --- a/modules/sys/config.go +++ b/modules/sys/config.go @@ -2,6 +2,7 @@ package sys import ( "fmt" + "go_dreamfactory/comm" "go_dreamfactory/lego/core" "go_dreamfactory/modules" "go_dreamfactory/sys/configure" @@ -28,8 +29,6 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp //this.LoadConfigure(gameOpencond, cfg.NewGameOpencond) configure.RegisterConfigure(gameOpencond, cfg.NewGameOpencond, this.LoadCondConfig) this.module = module.(*ModuleSys) - - this.getFuncCfg("sign") return } @@ -85,11 +84,22 @@ func (this *configureComp) getOpencondCfg() (data *cfg.GameOpencond, err error) return } -func (this *configureComp) getFuncCfg(funcName string) (data *cfg.GameOpencondData) { - if cfg, err := this.getOpencondCfg(); err == nil { - data = cfg.GetDataMap()[funcName] +func (this *configureComp) GetOpenCondCfgById(id string) (data *cfg.GameOpencondData, err error) { + var ( + v interface{} + ) + if v, err = this.GetConfigure(gameOpencond); err == nil { + + if c, ok := v.(*cfg.GameOpencond); ok { + if data = c.Get(id); data != nil { + return + } + + } } - return nil + + err = comm.NewNotFoundConfErr("opencond", gameOpencond, id) + return } func (this *configureComp) getOpencondList() (list []*cfg.GameOpencondData) { diff --git a/modules/sys/module.go b/modules/sys/module.go index 6b8b01c49..5d3dff47a 100644 --- a/modules/sys/module.go +++ b/modules/sys/module.go @@ -94,3 +94,7 @@ func (this *ModuleSys) AutoActivate(session comm.IUserSession, cids []string) bo }) return true } + +func (this *ModuleSys) GetOpenCondCfgById(id string) (data *cfg.GameOpencondData, err error) { + return this.configure.GetOpenCondCfgById(id) +}