diff --git a/server/gameserver/human.cc b/server/gameserver/human.cc index 331938b..109f7d4 100644 --- a/server/gameserver/human.cc +++ b/server/gameserver/human.cc @@ -2555,6 +2555,7 @@ void Human::SendBattleReport() url = "http://game2004api.kingsome.cn/webapp/index.php?c=Role&a=battleReport"; } } + JsonDataMgr::Instance()->GetBattleReportUrl(url); std::string data; params->ToUrlEncodeStr(data); f8::HttpClientPool::Instance()->HttpGet( diff --git a/server/gameserver/jsondatamgr.cc b/server/gameserver/jsondatamgr.cc index 4e81bcc..7f3761c 100644 --- a/server/gameserver/jsondatamgr.cc +++ b/server/gameserver/jsondatamgr.cc @@ -24,14 +24,28 @@ void JsonDataMgr::Init() }); } } + std::string gameserver_cluster_json_file; + std::string setting_json_file; + gameserver_cluster_json_file = a8::Format("%s/node%d/game%d.gameserver.cluster.json", { work_path_, App::Instance()->node_id, GAME_ID }); + setting_json_file = a8::Format("%s/game%d.gameserver.setting.json", + { + work_path_, + GAME_ID + }); gameserver_cluster_json_.ReadFromFile(gameserver_cluster_json_file); + setting_json_.ReadFromFile(setting_json_file); + if (setting_json_.GetType() == a8::XOT_OBJECT && + setting_json_.HasKey("battle_report_url")) { + battle_report_url_ = setting_json_.Get("battle_report_url").GetString(); + } + ip = GetConf()->At("ip")->AsXValue().GetString(); listen_port = GetConf()->At("listen_port")->AsXValue(); if (GetConf()->HasKey("channel")) { @@ -72,3 +86,10 @@ void JsonDataMgr::Reload() }); masterserver_cluster_json_.ReadFromFile(masterserver_cluster_json_file); } + +void JsonDataMgr::GetBattleReportUrl(std::string& url) +{ + if (!battle_report_url_.empty()) { + url = battle_report_url_; + } +} diff --git a/server/gameserver/jsondatamgr.h b/server/gameserver/jsondatamgr.h index ffd259a..7eb81af 100644 --- a/server/gameserver/jsondatamgr.h +++ b/server/gameserver/jsondatamgr.h @@ -19,9 +19,14 @@ public: std::string server_info; void Reload(); + void GetBattleReportUrl(std::string& url); + +private: + std::string battle_report_url_; private: std::string work_path_ = "../config"; + a8::XObject setting_json_; a8::XObject gameserver_cluster_json_; a8::XObject masterserver_cluster_json_; };