1
This commit is contained in:
parent
86420aae26
commit
ca48d9150f
@ -4,8 +4,16 @@
|
|||||||
#include "framework/cpp/tglog.h"
|
#include "framework/cpp/tglog.h"
|
||||||
#include <a8/mutable_xobject.h>
|
#include <a8/mutable_xobject.h>
|
||||||
#include "player.h"
|
#include "player.h"
|
||||||
|
|
||||||
#include "app.h"
|
#include "app.h"
|
||||||
|
|
||||||
|
const char* const FRIEND_LOGIN_EVENT = "friend_login";
|
||||||
|
const char* const FRIEND_LOGOUT_EVENT = "friend_logout";
|
||||||
|
const char* const FRIEND_APPLY_EVENT = "friend_apply";
|
||||||
|
const char* const FRIEND_REFUSE_EVENT = "friend_refuse";
|
||||||
|
const char* const FRIEND_AGREE_EVENT = "friend_agree";
|
||||||
|
const char* const FRIEND_DELETE_EVENT = "friend_delete";
|
||||||
|
|
||||||
void GameLog::Init()
|
void GameLog::Init()
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -18,30 +26,169 @@ void GameLog::UnInit()
|
|||||||
|
|
||||||
void GameLog::Login(Player* hum)
|
void GameLog::Login(Player* hum)
|
||||||
{
|
{
|
||||||
|
int game_id = f8::ExtractGameIdFromAccountId(hum->AccountId());
|
||||||
|
std::string channel = a8::XValue(f8::ExtractChannelIdFromAccountId(hum->AccountId()));
|
||||||
|
|
||||||
|
a8::MutableXObject* prop = a8::MutableXObject::NewObject();
|
||||||
|
prop->SetVal("channel", channel);
|
||||||
|
prop->SetVal("ad_channel", "");
|
||||||
|
prop->SetVal("gameid", game_id);
|
||||||
|
prop->SetVal("account_id", hum->AccountId());
|
||||||
|
prop->SetVal("account_register_utctime", hum->account_registertime);
|
||||||
|
prop->SetVal("account_register_date", a8::TimestampToDateTime(hum->account_registertime));
|
||||||
|
prop->SetVal("nickname", hum->NickName());
|
||||||
|
prop->SetVal("user_value1", a8::XValue(hum->myself.base_data.user_value1).GetString());
|
||||||
|
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);
|
||||||
|
|
||||||
|
f8::TGLog::Instance()->AddTrackLog(game_id,
|
||||||
|
hum->AccountId(),
|
||||||
|
hum->ip_saddr,
|
||||||
|
FRIEND_LOGIN_EVENT,
|
||||||
|
prop);
|
||||||
|
|
||||||
|
delete prop;
|
||||||
|
prop = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameLog::Logout(Player* hum)
|
void GameLog::Logout(Player* hum)
|
||||||
{
|
{
|
||||||
|
int game_id = f8::ExtractGameIdFromAccountId(hum->AccountId());
|
||||||
|
std::string channel = a8::XValue(f8::ExtractChannelIdFromAccountId(hum->AccountId()));
|
||||||
|
|
||||||
|
a8::MutableXObject* prop = a8::MutableXObject::NewObject();
|
||||||
|
prop->SetVal("channel", channel);
|
||||||
|
prop->SetVal("ad_channel", "");
|
||||||
|
prop->SetVal("gameid", game_id);
|
||||||
|
prop->SetVal("account_id", hum->AccountId());
|
||||||
|
prop->SetVal("account_register_utctime", hum->account_registertime);
|
||||||
|
prop->SetVal("account_register_date", a8::TimestampToDateTime(hum->account_registertime));
|
||||||
|
prop->SetVal("nickname", hum->NickName());
|
||||||
|
prop->SetVal("user_value1", a8::XValue(hum->myself.base_data.user_value1).GetString());
|
||||||
|
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);
|
||||||
|
|
||||||
|
f8::TGLog::Instance()->AddTrackLog(game_id,
|
||||||
|
hum->AccountId(),
|
||||||
|
hum->ip_saddr,
|
||||||
|
FRIEND_LOGOUT_EVENT,
|
||||||
|
prop);
|
||||||
|
|
||||||
|
delete prop;
|
||||||
|
prop = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameLog::FriendApply(Player* hum, const std::string& account_id)
|
void GameLog::FriendApply(Player* hum, const std::string& account_id)
|
||||||
{
|
{
|
||||||
|
int game_id = f8::ExtractGameIdFromAccountId(hum->AccountId());
|
||||||
|
std::string channel = a8::XValue(f8::ExtractChannelIdFromAccountId(hum->AccountId()));
|
||||||
|
|
||||||
|
a8::MutableXObject* prop = a8::MutableXObject::NewObject();
|
||||||
|
prop->SetVal("channel", channel);
|
||||||
|
prop->SetVal("ad_channel", "");
|
||||||
|
prop->SetVal("gameid", game_id);
|
||||||
|
prop->SetVal("account_id", hum->AccountId());
|
||||||
|
prop->SetVal("account_register_utctime", hum->account_registertime);
|
||||||
|
prop->SetVal("account_register_date", a8::TimestampToDateTime(hum->account_registertime));
|
||||||
|
prop->SetVal("nickname", hum->NickName());
|
||||||
|
prop->SetVal("server_instance_id", App::Instance()->instance_id);
|
||||||
|
prop->SetVal("target_id", account_id);
|
||||||
|
|
||||||
|
f8::TGLog::Instance()->AddTrackLog(game_id,
|
||||||
|
hum->AccountId(),
|
||||||
|
hum->ip_saddr,
|
||||||
|
FRIEND_APPLY_EVENT,
|
||||||
|
prop);
|
||||||
|
|
||||||
|
delete prop;
|
||||||
|
prop = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameLog::FriendRefuse(Player* hum, const std::string& account_id)
|
void GameLog::FriendRefuse(Player* hum, const std::string& account_id)
|
||||||
{
|
{
|
||||||
|
int game_id = f8::ExtractGameIdFromAccountId(hum->AccountId());
|
||||||
|
std::string channel = a8::XValue(f8::ExtractChannelIdFromAccountId(hum->AccountId()));
|
||||||
|
|
||||||
|
a8::MutableXObject* prop = a8::MutableXObject::NewObject();
|
||||||
|
prop->SetVal("channel", channel);
|
||||||
|
prop->SetVal("ad_channel", "");
|
||||||
|
prop->SetVal("gameid", game_id);
|
||||||
|
prop->SetVal("account_id", hum->AccountId());
|
||||||
|
prop->SetVal("account_register_utctime", hum->account_registertime);
|
||||||
|
prop->SetVal("account_register_date", a8::TimestampToDateTime(hum->account_registertime));
|
||||||
|
prop->SetVal("nickname", hum->NickName());
|
||||||
|
prop->SetVal("user_value1", a8::XValue(hum->myself.base_data.user_value1).GetString());
|
||||||
|
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("target_id", account_id);
|
||||||
|
|
||||||
|
f8::TGLog::Instance()->AddTrackLog(game_id,
|
||||||
|
hum->AccountId(),
|
||||||
|
hum->ip_saddr,
|
||||||
|
FRIEND_REFUSE_EVENT,
|
||||||
|
prop);
|
||||||
|
|
||||||
|
delete prop;
|
||||||
|
prop = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameLog::FriendAgree(Player* hum, const std::string& account_id)
|
void GameLog::FriendAgree(Player* hum, const std::string& account_id)
|
||||||
{
|
{
|
||||||
|
int game_id = f8::ExtractGameIdFromAccountId(hum->AccountId());
|
||||||
|
std::string channel = a8::XValue(f8::ExtractChannelIdFromAccountId(hum->AccountId()));
|
||||||
|
|
||||||
|
a8::MutableXObject* prop = a8::MutableXObject::NewObject();
|
||||||
|
prop->SetVal("channel", channel);
|
||||||
|
prop->SetVal("ad_channel", "");
|
||||||
|
prop->SetVal("gameid", game_id);
|
||||||
|
prop->SetVal("account_id", hum->AccountId());
|
||||||
|
prop->SetVal("account_register_utctime", hum->account_registertime);
|
||||||
|
prop->SetVal("account_register_date", a8::TimestampToDateTime(hum->account_registertime));
|
||||||
|
prop->SetVal("nickname", hum->NickName());
|
||||||
|
prop->SetVal("user_value1", a8::XValue(hum->myself.base_data.user_value1).GetString());
|
||||||
|
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("target_id", account_id);
|
||||||
|
|
||||||
|
f8::TGLog::Instance()->AddTrackLog(game_id,
|
||||||
|
hum->AccountId(),
|
||||||
|
hum->ip_saddr,
|
||||||
|
FRIEND_AGREE_EVENT,
|
||||||
|
prop);
|
||||||
|
|
||||||
|
delete prop;
|
||||||
|
prop = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameLog::FriendDelete(Player* hum, const std::string& account_id)
|
void GameLog::FriendDelete(Player* hum, const std::string& account_id)
|
||||||
{
|
{
|
||||||
|
int game_id = f8::ExtractGameIdFromAccountId(hum->AccountId());
|
||||||
|
std::string channel = a8::XValue(f8::ExtractChannelIdFromAccountId(hum->AccountId()));
|
||||||
|
|
||||||
|
a8::MutableXObject* prop = a8::MutableXObject::NewObject();
|
||||||
|
prop->SetVal("channel", channel);
|
||||||
|
prop->SetVal("ad_channel", "");
|
||||||
|
prop->SetVal("gameid", game_id);
|
||||||
|
prop->SetVal("account_id", hum->AccountId());
|
||||||
|
prop->SetVal("account_register_utctime", hum->account_registertime);
|
||||||
|
prop->SetVal("account_register_date", a8::TimestampToDateTime(hum->account_registertime));
|
||||||
|
prop->SetVal("nickname", hum->NickName());
|
||||||
|
prop->SetVal("user_value1", a8::XValue(hum->myself.base_data.user_value1).GetString());
|
||||||
|
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("target_id", account_id);
|
||||||
|
|
||||||
|
f8::TGLog::Instance()->AddTrackLog(game_id,
|
||||||
|
hum->AccountId(),
|
||||||
|
hum->ip_saddr,
|
||||||
|
FRIEND_DELETE_EVENT,
|
||||||
|
prop);
|
||||||
|
|
||||||
|
delete prop;
|
||||||
|
prop = nullptr;
|
||||||
}
|
}
|
||||||
|
@ -874,6 +874,11 @@ const std::string Player::SessionId()
|
|||||||
return role_data.session_id;
|
return role_data.session_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const std::string Player::NickName()
|
||||||
|
{
|
||||||
|
return myself.base_data.nickname;
|
||||||
|
}
|
||||||
|
|
||||||
int Player::GetFriendNum()
|
int Player::GetFriendNum()
|
||||||
{
|
{
|
||||||
return friend_hash_.size();
|
return friend_hash_.size();
|
||||||
|
@ -18,6 +18,8 @@ class Player
|
|||||||
|
|
||||||
Friend myself;
|
Friend myself;
|
||||||
RoleData role_data;
|
RoleData role_data;
|
||||||
|
long ip_saddr = 0;
|
||||||
|
int account_registertime = 0;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void Init();
|
void Init();
|
||||||
@ -103,6 +105,7 @@ class Player
|
|||||||
|
|
||||||
const std::string AccountId();
|
const std::string AccountId();
|
||||||
const std::string SessionId();
|
const std::string SessionId();
|
||||||
|
const std::string NickName();
|
||||||
int GetFriendNum();
|
int GetFriendNum();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user