diff --git a/server/gameserver/human.cc b/server/gameserver/human.cc index 0a16500f..1fd606d1 100644 --- a/server/gameserver/human.cc +++ b/server/gameserver/human.cc @@ -3650,11 +3650,8 @@ void Human::SendPersonalBattleReport() } std::string url; JsonDataMgr::Instance()->GetApiUrl(url); - if (url.find('?') != std::string::npos) { - url += "c=Battle&a=personalReport"; - } else { - url += "?c=Battle&a=personalReport"; - } + params->SetVal("c", "Battle"); + params->SetVal("a", "personalReport"); std::string data; params->ToUrlEncodeStr(data); HttpProxy::Instance()->HttpGet diff --git a/server/gameserver/player.cc b/server/gameserver/player.cc index bf25b12c..2d161588 100644 --- a/server/gameserver/player.cc +++ b/server/gameserver/player.cc @@ -1378,12 +1378,9 @@ void Player::_CMRevive(f8::MsgHdr* hdr, const cs::CMRevive& msg) { std::string url; JsonDataMgr::Instance()->GetApiUrl(url); - if (url.find('?') != std::string::npos) { - url += "&c=Battle&a=decReviveCoin"; - } else { - url += "?&c=Battle&a=decReviveCoin"; - } auto url_params = a8::MutableXObject::CreateObject(); + url_params->SetVal("c", "Battle"); + url_params->SetVal("a", "decReviveCoin"); url_params->SetVal("account_id", account_id); url_params->SetVal("session_id", session_id); url_params->SetVal("target_id", hum->account_id); diff --git a/server/gameserver/room.cc b/server/gameserver/room.cc index 47bb36c0..4754ff94 100644 --- a/server/gameserver/room.cc +++ b/server/gameserver/room.cc @@ -2236,13 +2236,10 @@ void Room::TryMobaReport(int try_count) } std::string url; JsonDataMgr::Instance()->GetApiUrl(url); - if (url.find('?') != std::string::npos) { - url += "c=Battle&a=mobaTeamReport"; - } else { - url += "?c=Battle&a=mobaTeamReport"; - } std::shared_ptr params = a8::MutableXObject::CreateObject(); std::shared_ptr post_data = a8::MutableXObject::CreateObject(); + params->SetVal("c", "Battle"); + params->SetVal("a", "mobaTeamReport"); params->SetVal("account_id", player->account_id); params->SetVal("session_id", player->session_id); GenBattleMobaReportData(post_data.get()); @@ -4113,14 +4110,11 @@ void Room::TryRoomReport(int try_count) } std::string url; JsonDataMgr::Instance()->GetApiUrl(url); - if (url.find('?') != std::string::npos) { - url += "c=Battle&a=roomReport"; - } else { - url += "?c=Battle&a=roomReport"; - } std::shared_ptr params = a8::MutableXObject::CreateObject(); std::shared_ptr post_data = a8::MutableXObject::CreateObject(); GenBattleRoomReportData(post_data.get()); + params->SetVal("c", "Battle"); + params->SetVal("a", "roomReport"); params->SetVal("account_id", player->account_id); params->SetVal("session_id", player->session_id); std::string content = post_data->ToJsonStr(); diff --git a/server/gameserver/roommgr.cc b/server/gameserver/roommgr.cc index 368d0e22..cb366433 100644 --- a/server/gameserver/roommgr.cc +++ b/server/gameserver/roommgr.cc @@ -596,22 +596,15 @@ void RoomMgr::SendGetCustomBattleData(std::shared_ptr join_msg, { std::string url; JsonDataMgr::Instance()->GetApiUrl(url); + auto url_params = a8::MutableXObject::CreateObject(); + url_params->SetVal("c", "Battle"); if (custom_room_type == CUSTOM_ROOM_CUSTOM) { - if (url.find('?') != std::string::npos) { - url += "&c=Battle&a=getCustomBattleDataNew"; - } else { - url += "?&c=Battle&a=getCustomBattleDataNew"; - } + url_params->SetVal("a", "getCustomBattleDataNew"); } else if (custom_room_type == CUSTOM_ROOM_NORMAL) { - if (url.find('?') != std::string::npos) { - url += "&c=Battle&a=getNormalBattleData"; - } else { - url += "?&c=Battle&a=getNormalBattleData"; - } + url_params->SetVal("a", "getNormalBattleData"); } else { A8_ABORT(); } - auto url_params = a8::MutableXObject::CreateObject(); url_params->SetVal("account_id", join_msg->account_id()); url_params->SetVal("session_id", join_msg->session_id()); url_params->SetVal("version", 1); diff --git a/server/gameserver/team.cc b/server/gameserver/team.cc index b09bcf63..0c2119d1 100644 --- a/server/gameserver/team.cc +++ b/server/gameserver/team.cc @@ -211,12 +211,9 @@ void Team::SendTeamBattleReport(Human* sender) #endif std::string url; JsonDataMgr::Instance()->GetApiUrl(url); - if (url.find('?') != std::string::npos) { - url += "c=Battle&a=teamReport"; - } else { - url += "?c=Battle&a=teamReport"; - } std::shared_ptr params = a8::MutableXObject::CreateObject(); + params->SetVal("c", "Battle"); + params->SetVal("a", "teamReport"); params->SetVal("account_id", player->account_id); params->SetVal("session_id", player->session_id); params->SetVal("__POST", post_data->ToJsonStr());