完成好友系统埋点

This commit is contained in:
aozhiwei 2020-06-28 20:45:40 +08:00
parent ca48d9150f
commit 7d9f9ac77a
4 changed files with 13 additions and 4 deletions

View File

@ -106,7 +106,7 @@ void GameLog::FriendApply(Player* hum, const std::string& account_id)
prop = nullptr;
}
void GameLog::FriendRefuse(Player* hum, const std::string& account_id)
void GameLog::FriendRefuse(Player* hum, long long db_idx, const std::string& account_id)
{
int game_id = f8::ExtractGameIdFromAccountId(hum->AccountId());
std::string channel = a8::XValue(f8::ExtractChannelIdFromAccountId(hum->AccountId()));
@ -123,6 +123,7 @@ void GameLog::FriendRefuse(Player* hum, const std::string& account_id)
prop->SetVal("user_value2", a8::XValue(hum->myself.base_data.user_value2).GetString());
prop->SetVal("user_value3", a8::XValue(hum->myself.base_data.user_value3).GetString());
prop->SetVal("server_instance_id", App::Instance()->instance_id);
prop->SetVal("db_idx", db_idx);
prop->SetVal("target_id", account_id);
f8::TGLog::Instance()->AddTrackLog(game_id,
@ -135,7 +136,7 @@ void GameLog::FriendRefuse(Player* hum, const std::string& account_id)
prop = nullptr;
}
void GameLog::FriendAgree(Player* hum, const std::string& account_id)
void GameLog::FriendAgree(Player* hum, long long db_idx, const std::string& account_id)
{
int game_id = f8::ExtractGameIdFromAccountId(hum->AccountId());
std::string channel = a8::XValue(f8::ExtractChannelIdFromAccountId(hum->AccountId()));
@ -152,6 +153,7 @@ void GameLog::FriendAgree(Player* hum, const std::string& account_id)
prop->SetVal("user_value2", a8::XValue(hum->myself.base_data.user_value2).GetString());
prop->SetVal("user_value3", a8::XValue(hum->myself.base_data.user_value3).GetString());
prop->SetVal("server_instance_id", App::Instance()->instance_id);
prop->SetVal("db_idx", db_idx);
prop->SetVal("target_id", account_id);
f8::TGLog::Instance()->AddTrackLog(game_id,

View File

@ -15,8 +15,8 @@ class GameLog : public a8::Singleton<GameLog>
void Logout(Player* hum);
void FriendApply(Player* hum, const std::string& account_id);
void FriendRefuse(Player* hum, const std::string& account_id);
void FriendAgree(Player* hum, const std::string& account_id);
void FriendRefuse(Player* hum, long long db_idx, const std::string& account_id);
void FriendAgree(Player* hum, long long db_idx, const std::string& account_id);
void FriendDelete(Player* hum, const std::string& account_id);
private:

View File

@ -15,6 +15,7 @@
#include "app.h"
#include "typeconvert.h"
#include "playermgr.h"
#include "gamelog.h"
#include "IMConn.h"
#include "IMConnMgr.h"
@ -170,6 +171,7 @@ void Player::_CMFriendApply(f8::MsgHdr& hdr, const cs::CMFriendApply& msg)
SendMsg(respmsg);
QueryUserOnline({msg.friend_id()});
DBHelper::Instance()->AddFriendApply(this, msg.friend_id());
GameLog::Instance()->FriendApply(this, msg.friend_id());
}
void Player::_CMFriendApplyList(f8::MsgHdr& hdr, const cs::CMFriendApplyList& msg)
@ -303,6 +305,7 @@ void Player::_CMFriendAgree(f8::MsgHdr& hdr, const cs::CMFriendAgree& msg)
1
);
ClearApplyBySenderId(msg.apply().base_data().account_id());
GameLog::Instance()->FriendAgree(this, msg.apply().idx(), msg.apply().base_data().account_id());
}
void Player::_CMFriendRefuse(f8::MsgHdr& hdr, const cs::CMFriendRefuse& msg)
@ -319,6 +322,7 @@ void Player::_CMFriendRefuse(f8::MsgHdr& hdr, const cs::CMFriendRefuse& msg)
2
);
ClearApplyByIdx(msg.apply().idx());
GameLog::Instance()->FriendRefuse(this, msg.apply().idx(), msg.apply().base_data().account_id());
}
void Player::_CMFriendDelete(f8::MsgHdr& hdr, const cs::CMFriendDelete& msg)
@ -335,6 +339,7 @@ void Player::_CMFriendDelete(f8::MsgHdr& hdr, const cs::CMFriendDelete& msg)
notifymsg.add_user_list(msg.friend_id());
SendMsg(notifymsg);
}
GameLog::Instance()->FriendDelete(this, msg.friend_id());
}
void Player::_CMFriendBlackList(f8::MsgHdr& hdr, const cs::CMFriendBlackList& msg)

View File

@ -444,6 +444,7 @@ void PlayerMgr::AsyncLoginOnOk(const std::string& account_id,
{
hum = new Player();
hum->socket_handle = hdr->socket_handle;
hum->ip_saddr = hdr->ip_saddr;
hum->myself.base_data.account_id = account_id;
hum->myself.base_data.nickname = nickname;
hum->myself.base_data.avatar_url = avatar_url;
@ -455,6 +456,7 @@ void PlayerMgr::AsyncLoginOnOk(const std::string& account_id,
hum->myself.base_data.online = true;
hum->myself.base_data.last_login_time = App::Instance()->nowtime;
hum->role_data.session_id = session_id;
hum->account_registertime = f8::ExtractRegisterTimeFromSessionId(session_id);
{
ss::MFUserDB user_db;
user_db.ParseFromString(friend_data);