From aa6d1d2134b39c123523d6ad33110072474f610a Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Thu, 13 Oct 2022 14:06:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=A2=A6=E5=A2=83=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/json/game_dreamlandtrigger.json | 21 +++++++++++++++++--- bin/json/game_msgdistrib.json | 7 +++++++ modules/gateway/configure_comp.go | 6 ++++-- sys/configure/structs/game.msgDistrib.go | 14 ++++++------- sys/configure/structs/game.msgDistribData.go | 2 ++ 5 files changed, 37 insertions(+), 13 deletions(-) diff --git a/bin/json/game_dreamlandtrigger.json b/bin/json/game_dreamlandtrigger.json index 7ed420298..40ae01665 100644 --- a/bin/json/game_dreamlandtrigger.json +++ b/bin/json/game_dreamlandtrigger.json @@ -1,12 +1,27 @@ [ { "id": 1, - "dreamland_pro": 500, + "dreamland_pro": 1000, "open": true }, { "id": 2, - "dreamland_pro": 100, - "open": false + "dreamland_pro": 1000, + "open": true + }, + { + "id": 3, + "dreamland_pro": 1000, + "open": true + }, + { + "id": 4, + "dreamland_pro": 1000, + "open": true + }, + { + "id": 5, + "dreamland_pro": 1000, + "open": true } ] \ No newline at end of file diff --git a/bin/json/game_msgdistrib.json b/bin/json/game_msgdistrib.json index 40c739134..5341d1d15 100644 --- a/bin/json/game_msgdistrib.json +++ b/bin/json/game_msgdistrib.json @@ -1,36 +1,43 @@ [ { "msgid": "notify", + "open": true, "routrules": "~/worker", "describe": "公告系统" }, { "msgid": "forum", + "open": true, "routrules": "~/worker", "describe": "论坛系统" }, { "msgid": "chat.chanagechannel", + "open": true, "routrules": "~/worker", "describe": "聊天系统" }, { "msgid": "chat.crosschannel", + "open": true, "routrules": "~/worker", "describe": "聊天系统" }, { "msgid": "chat.getcrosslist", + "open": true, "routrules": "~/worker", "describe": "聊天系统" }, { "msgid": "chat.sendcross", + "open": true, "routrules": "~/worker", "describe": "聊天系统" }, { "msgid": "moonfantasy", + "open": false, "routrules": "~/worker", "describe": "月之秘境" } diff --git a/modules/gateway/configure_comp.go b/modules/gateway/configure_comp.go index 0955db306..be06b32b3 100644 --- a/modules/gateway/configure_comp.go +++ b/modules/gateway/configure_comp.go @@ -36,13 +36,15 @@ func (this *configureComp) GetMsgDistribute(msgmid, msguid string) (rule string, ok = false return } else { - if item, ok = v.(*cfg.GameMsgdistrib).GetDataMap()[msgmid]; ok { + if item, ok = v.(*cfg.GameMsgdistrib).GetDataMap()[msgmid]; ok && item.Open { rule = item.Routrules } else { msgid := strings.ToLower(fmt.Sprintf("%s.%s", msgmid, msguid)) - if item, ok = v.(*cfg.GameMsgdistrib).GetDataMap()[msgid]; ok { + if item, ok = v.(*cfg.GameMsgdistrib).GetDataMap()[msgid]; ok && item.Open { rule = item.Routrules + return } + ok = false } } return diff --git a/sys/configure/structs/game.msgDistrib.go b/sys/configure/structs/game.msgDistrib.go index 3a5331073..9ab8a5814 100644 --- a/sys/configure/structs/game.msgDistrib.go +++ b/sys/configure/structs/game.msgDistrib.go @@ -9,8 +9,8 @@ package cfg type GameMsgdistrib struct { - _dataMap map[string]*GameMsgdistribData - _dataList []*GameMsgdistribData + _dataMap map[string]*GameMsgdistribData + _dataList []*GameMsgdistribData } func NewGameMsgdistrib(_buf []map[string]interface{}) (*GameMsgdistrib, error) { @@ -24,19 +24,17 @@ func NewGameMsgdistrib(_buf []map[string]interface{}) (*GameMsgdistrib, error) { dataMap[_v.Msgid] = _v } } - return &GameMsgdistrib{_dataList:_dataList, _dataMap:dataMap}, nil + return &GameMsgdistrib{_dataList: _dataList, _dataMap: dataMap}, nil } func (table *GameMsgdistrib) GetDataMap() map[string]*GameMsgdistribData { - return table._dataMap + return table._dataMap } func (table *GameMsgdistrib) GetDataList() []*GameMsgdistribData { - return table._dataList + return table._dataList } func (table *GameMsgdistrib) Get(key string) *GameMsgdistribData { - return table._dataMap[key] + return table._dataMap[key] } - - diff --git a/sys/configure/structs/game.msgDistribData.go b/sys/configure/structs/game.msgDistribData.go index d931deb78..2e1ba2d47 100644 --- a/sys/configure/structs/game.msgDistribData.go +++ b/sys/configure/structs/game.msgDistribData.go @@ -12,6 +12,7 @@ import "errors" type GameMsgdistribData struct { Msgid string + Open bool Routrules string Describe string } @@ -24,6 +25,7 @@ func (*GameMsgdistribData) GetTypeId() int32 { func (_v *GameMsgdistribData)Deserialize(_buf map[string]interface{}) (err error) { { var _ok_ bool; if _v.Msgid, _ok_ = _buf["msgid"].(string); !_ok_ { err = errors.New("msgid error"); return } } + { var _ok_ bool; if _v.Open, _ok_ = _buf["open"].(bool); !_ok_ { err = errors.New("open error"); return } } { var _ok_ bool; if _v.Routrules, _ok_ = _buf["routrules"].(string); !_ok_ { err = errors.New("routrules error"); return } } { var _ok_ bool; if _v.Describe, _ok_ = _buf["describe"].(string); !_ok_ { err = errors.New("describe error"); return } } return