This commit is contained in:
aozhiwei 2022-12-27 09:33:27 +08:00
parent 3ee45a8616
commit 2f55ddd5d3
5 changed files with 12 additions and 23 deletions

View File

@ -16,7 +16,7 @@ void GameLog::GameStart(Player* hum)
int game_id = f8::ExtractGameIdFromAccountId(hum->account_id); int game_id = f8::ExtractGameIdFromAccountId(hum->account_id);
std::string channel = a8::XValue(f8::ExtractChannelIdFromAccountId(hum->account_id)); std::string channel = a8::XValue(f8::ExtractChannelIdFromAccountId(hum->account_id));
a8::MutableXObject* prop = a8::MutableXObject::NewObject(); auto prop = a8::MutableXObject::CreateObject();
prop->SetVal("channel", channel); prop->SetVal("channel", channel);
prop->SetVal("ad_channel", ""); prop->SetVal("ad_channel", "");
prop->SetVal("from_appid", hum->from_appid); prop->SetVal("from_appid", hum->from_appid);
@ -40,10 +40,7 @@ void GameLog::GameStart(Player* hum)
prop->SetVal("map_name", hum->room->GetMapMeta()->map_name()); prop->SetVal("map_name", hum->room->GetMapMeta()->map_name());
prop->SetVal("map_tpl_name", hum->room->GetMapTplName()); prop->SetVal("map_tpl_name", hum->room->GetMapTplName());
f8::TGLog::Instance()->AddTrackLog(game_id, hum->account_id, hum->ip_saddr, logclass1, logclass2, prop); f8::TGLog::Instance()->AddTrackLog(game_id, hum->account_id, hum->ip_saddr, logclass1, logclass2, prop.get());
delete prop;
prop = nullptr;
} }
void GameLog::GameEnd(Player* hum) void GameLog::GameEnd(Player* hum)
@ -53,7 +50,7 @@ void GameLog::GameEnd(Player* hum)
int game_id = f8::ExtractGameIdFromAccountId(hum->account_id); int game_id = f8::ExtractGameIdFromAccountId(hum->account_id);
std::string channel = a8::XValue(f8::ExtractChannelIdFromAccountId(hum->account_id)); std::string channel = a8::XValue(f8::ExtractChannelIdFromAccountId(hum->account_id));
a8::MutableXObject* prop = a8::MutableXObject::NewObject(); auto prop = a8::MutableXObject::CreateObject();
prop->SetVal("channel", channel); prop->SetVal("channel", channel);
prop->SetVal("ad_channel", ""); prop->SetVal("ad_channel", "");
prop->SetVal("from_appid", hum->from_appid); prop->SetVal("from_appid", hum->from_appid);
@ -90,17 +87,14 @@ void GameLog::GameEnd(Player* hum)
prop->SetVal("gameover_pass_frame_num", hum->room->GetFrameNo() - hum->last_cmmove_frameno); prop->SetVal("gameover_pass_frame_num", hum->room->GetFrameNo() - hum->last_cmmove_frameno);
prop->SetVal("socket_handle", hum->socket_handle); prop->SetVal("socket_handle", hum->socket_handle);
f8::TGLog::Instance()->AddTrackLog(game_id, hum->account_id, hum->ip_saddr, logclass1, logclass2, prop); f8::TGLog::Instance()->AddTrackLog(game_id, hum->account_id, hum->ip_saddr, logclass1, logclass2, prop.get());
delete prop;
prop = nullptr;
} }
void GameLog::ForceOver(Room* room) void GameLog::ForceOver(Room* room)
{ {
int game_id = GAME_ID; int game_id = GAME_ID;
a8::MutableXObject* prop = a8::MutableXObject::NewObject(); auto prop = a8::MutableXObject::CreateObject();
prop->SetVal("game_uniid", a8::XValue(room->GetRoomUuid()).GetString()); prop->SetVal("game_uniid", a8::XValue(room->GetRoomUuid()).GetString());
prop->SetVal("room_type", a8::XValue(room->GetRoomType()).GetString()); prop->SetVal("room_type", a8::XValue(room->GetRoomType()).GetString());
prop->SetVal("room_mode", a8::XValue((int)room->GetRoomMode())); prop->SetVal("room_mode", a8::XValue((int)room->GetRoomMode()));
@ -108,8 +102,5 @@ void GameLog::ForceOver(Room* room)
prop->SetVal("game_duration", room->GetFrameNo() * SERVER_FRAME_RATE); prop->SetVal("game_duration", room->GetFrameNo() * SERVER_FRAME_RATE);
prop->SetVal("player_num", room->GetRealPlayerNum()); prop->SetVal("player_num", room->GetRealPlayerNum());
f8::TGLog::Instance()->AddTrackLog(game_id, "forceover", 0, "forceover", prop); f8::TGLog::Instance()->AddTrackLog(game_id, "forceover", 0, "forceover", prop.get());
delete prop;
prop = nullptr;
} }

View File

@ -102,10 +102,10 @@ static void ParseElemets(const std::string& textid,
} }
{ {
a8::MutableXObject* obj = a8::MutableXObject::NewObject(); auto obj = a8::MutableXObject::CreateObject();
a8::MutableXObject* arr = a8::MutableXObject::NewArray(); auto arr = a8::MutableXObject::CreateArray();
for (auto& e : elements) { for (auto& e : elements) {
a8::MutableXObject* obj_el = a8::MutableXObject::NewObject(); auto obj_el = a8::MutableXObject::CreateObject();
obj_el->SetVal("type", std::get<0>(e)); obj_el->SetVal("type", std::get<0>(e));
obj_el->SetVal("val", std::get<1>(e)); obj_el->SetVal("val", std::get<1>(e));
arr->Push(*obj_el); arr->Push(*obj_el);
@ -121,7 +121,6 @@ static void ParseElemets(const std::string& textid,
} }
); );
#endif #endif
delete obj;
} }
} }

View File

@ -466,7 +466,7 @@ void RoomMgr::ReportServerState(int instance_id, const std::string& host, int po
host, host,
port port
}); });
a8::MutableXObject* url_params = a8::MutableXObject::NewObject(); auto url_params = a8::MutableXObject::CreateObject();
url_params->SetVal("node_id", App::Instance()->node_id); url_params->SetVal("node_id", App::Instance()->node_id);
url_params->SetVal("instance_id", App::Instance()->instance_id); url_params->SetVal("instance_id", App::Instance()->instance_id);
url_params->SetVal("ip", JsonDataMgr::Instance()->ip); url_params->SetVal("ip", JsonDataMgr::Instance()->ip);
@ -483,7 +483,6 @@ void RoomMgr::ReportServerState(int instance_id, const std::string& host, int po
*url_params, *url_params,
rand() % MAX_SYS_HTTP_NUM rand() % MAX_SYS_HTTP_NUM
); );
delete url_params;
} }
void RoomMgr::FreeOverRoom(long long room_uuid) void RoomMgr::FreeOverRoom(long long room_uuid)

2
third_party/a8 vendored

@ -1 +1 @@
Subproject commit 399eed8bd84c79e51960247bf75415088b9f3de1 Subproject commit 73177454ccb815e7e117a20dff16962b334991f3

2
third_party/f8 vendored

@ -1 +1 @@
Subproject commit 39ad1180c865f0e640ff8e07c85be5a64258236b Subproject commit 4933bf3dde65a20dbcb11b296e7a3a1aa4ac6ef6