This commit is contained in:
aozhiwei 2022-03-24 20:21:08 +08:00
parent b0defdf6de
commit ec62e3c734
2 changed files with 15 additions and 7 deletions

View File

@ -31,15 +31,14 @@ void JsonDataMgr::Init()
App::Instance()->node_id,
GAME_ID
});
setting_json_file = a8::Format("%s/game%d.gameserver.setting.json",
{
work_path_,
GAME_ID
});
setting_json_file = a8::Format("%s/httpproxy.cluster.json",
setting_json_file = a8::Format("%s/setting.json",
{
work_path_,
});
httpproxy_json_file = a8::Format("%s/httpproxy.cluster.json",
{
work_path_,
});
gameserver_cluster_json_.ReadFromFile(gameserver_cluster_json_file);
setting_json_.ReadFromFile(setting_json_file);
httpproxy_cluster_json_.ReadFromFile(httpproxy_json_file);
@ -116,7 +115,7 @@ void JsonDataMgr::GetApiUrl(std::string& url)
void JsonDataMgr::GetHttpProxyUrl(std::string& url)
{
if (!httpproxy_cluster_json_.Size() > 0) {
if (httpproxy_cluster_json_.Size() > 0) {
std::shared_ptr<a8::XObject> conf = httpproxy_cluster_json_.At(0);
url = conf->At("url")->AsXValue().GetString();
}

View File

@ -792,9 +792,12 @@ void RoomMgr::SendGetBattleData(int mode,
context.errmsg = "";
result->push_back(context);
}
#if 0
if (is_old_version) {
cb(*result);
return;
}
#endif
{
std::string url;
JsonDataMgr::Instance()->GetApiUrl(url);
@ -834,6 +837,9 @@ void RoomMgr::SendGetBattleData(int mode,
void(std::vector<BattleDataContext>&)>(cb)),
[] (a8::XParams& param, a8::XObject& data)
{
#ifdef DEBUG
a8::XPrintf("httpget ok\n", {});
#endif
auto result = (std::shared_ptr<std::vector<BattleDataContext>>*)param.sender.GetUserData();
auto cb = (std::function<
void(std::vector<BattleDataContext>&)>*)param.param1.GetUserData();
@ -847,6 +853,9 @@ void RoomMgr::SendGetBattleData(int mode,
},
[] (a8::XParams& param, const std::string& response)
{
#ifdef DEBUG
a8::XPrintf("httpget error\n", {});
#endif
auto result = (std::shared_ptr<std::vector<BattleDataContext>>*)param.sender.GetUserData();
auto cb = (std::function<
void(std::vector<BattleDataContext>&)>*)param.param1.GetUserData();