From ec62e3c734570ff9871f94a0d58b1df558056562 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 24 Mar 2022 20:21:08 +0800 Subject: [PATCH] 1 --- server/gameserver/jsondatamgr.cc | 13 ++++++------- server/gameserver/roommgr.cc | 9 +++++++++ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/server/gameserver/jsondatamgr.cc b/server/gameserver/jsondatamgr.cc index 05f60d0f..763bae54 100644 --- a/server/gameserver/jsondatamgr.cc +++ b/server/gameserver/jsondatamgr.cc @@ -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 conf = httpproxy_cluster_json_.At(0); url = conf->At("url")->AsXValue().GetString(); } diff --git a/server/gameserver/roommgr.cc b/server/gameserver/roommgr.cc index 9ba54bef..96bf44c1 100644 --- a/server/gameserver/roommgr.cc +++ b/server/gameserver/roommgr.cc @@ -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&)>(cb)), [] (a8::XParams& param, a8::XObject& data) { +#ifdef DEBUG + a8::XPrintf("httpget ok\n", {}); +#endif auto result = (std::shared_ptr>*)param.sender.GetUserData(); auto cb = (std::function< void(std::vector&)>*)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>*)param.sender.GetUserData(); auto cb = (std::function< void(std::vector&)>*)param.param1.GetUserData();