添加battleReportUrl自定义功能

This commit is contained in:
aozhiwei 2020-11-18 19:23:13 +08:00
parent 4ebeb286e9
commit aa84b1bf39
3 changed files with 27 additions and 0 deletions

View File

@ -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(

View File

@ -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_;
}
}

View File

@ -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_;
};