From 0597d946a2fc07b6d392e3e192a220f7bd3b0ea4 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Fri, 9 Jun 2023 17:59:37 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=9F=A5=E8=AF=A2opencond=20=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comm/imodule.go | 2 ++ modules/sys/config.go | 23 +++++++++++++++++------ modules/sys/module.go | 4 ++++ 3 files changed, 23 insertions(+), 6 deletions(-) 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..8aedb8f26 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,7 @@ 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") + this.getOpenCondCfgById("sign") return } @@ -85,11 +85,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) +} From 08a8764fe61eef39ba471b7e31e34451e55388db Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Fri, 9 Jun 2023 18:01:00 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E7=A7=BB=E5=87=BA=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/sys/config.go | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/sys/config.go b/modules/sys/config.go index 8aedb8f26..c461793c0 100644 --- a/modules/sys/config.go +++ b/modules/sys/config.go @@ -29,7 +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.getOpenCondCfgById("sign") return }