package gateway import ( "fmt" "go_dreamfactory/modules" cfg "go_dreamfactory/sys/configure/structs" "strings" "go_dreamfactory/lego/core" ) const ( game_msgdistrib = "game_msgdistrib.json" ) ///背包配置管理组件 type configureComp struct { modules.MCompConfigure } // Init 组件初始化接口 func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { this.MCompConfigure.Init(service, module, comp, options) this.LoadConfigure(game_msgdistrib, cfg.NewGameMsgdistrib) return } // GetMsgDistribute 获取消息分发规则读取配置表 func (this *configureComp) GetMsgDistribute(msgmid, msguid string) (rule string, ok bool) { var ( err error v interface{} item *cfg.GameMsgdistribData ) if v, err = this.GetConfigure(game_msgdistrib); err != nil { ok = false return } else { if item, ok = v.(*cfg.GameMsgdistrib).GetDataMap()[msgmid]; ok { rule = item.Routrules } else { msgid := strings.ToLower(fmt.Sprintf("%s.%s", msgmid, msguid)) item, ok = v.(*cfg.GameMsgdistrib).GetDataMap()[msgid] } } return }