This commit is contained in:
aozhiwei 2020-10-12 20:25:28 +08:00
parent d32dc250aa
commit b451c3d13f
2 changed files with 166 additions and 1 deletions

View File

@ -17,6 +17,15 @@ const char* const FRIEND_REFUSE_EVENT = "friend_refuse";
const char* const FRIEND_AGREE_EVENT = "friend_agree";
const char* const FRIEND_DELETE_EVENT = "friend_delete";
const char* const GUILD_CREATE_EVENT = "guild_create";
const char* const GUILD_APPLY_EVENT = "guild_apply";
const char* const GUILD_REFUSE_EVENT = "guild_refuse";
const char* const GUILD_AGREE_EVENT = "guild_agree";
const char* const GUILD_KICK_EVENT = "guild_kick";
const char* const GUILD_QUIT_EVENT = "guild_quit";
const char* const GUILD_SETJOB_EVENT = "guild_setjob";
const char* const GUILD_AGREE_INVITE_EVENT = "guild_agree_invite";
void GameLog::Init()
{
@ -203,40 +212,193 @@ void GameLog::FriendDelete(Player* hum, const std::string& account_id)
void GameLog::GuildCreate(Player* hum, long long guild_id, const std::string& guild_name)
{
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("guild_id", guild_id);
prop->SetVal("guild_name", guild_name);
f8::TGLog::Instance()->AddTrackLog(game_id,
hum->AccountId(),
hum->ip_saddr,
GUILD_CREATE_EVENT,
prop);
delete prop;
prop = nullptr;
}
void GameLog::GuildApply(Guild* guild, const cs::MFBaseUserData& base_data)
{
a8::MutableXObject* prop = a8::MutableXObject::NewObject();
prop->SetVal("gameid", guild->GetGameId());
prop->SetVal("channel", guild->GetChannel());
prop->SetVal("server_instance_id", App::Instance()->instance_id);
prop->SetVal("guild_id", guild->GuildId());
prop->SetVal("guild_name", guild->GuildName());
prop->SetVal("mumber_num", guild->GetMemberNum());
prop->SetVal("account_id", base_data.account_id());
prop->SetVal("nickname", base_data.nickname());
prop->SetVal("user_value1", a8::XValue(base_data.user_value1()).GetString());
prop->SetVal("user_value2", a8::XValue(base_data.user_value2()).GetString());
prop->SetVal("user_value3", a8::XValue(base_data.user_value3()).GetString());
f8::TGLog::Instance()->AddTrackLog(guild->GetGameId(),
base_data.account_id(),
0,
GUILD_APPLY_EVENT,
prop);
delete prop;
prop = nullptr;
}
void GameLog::GuildRefuse(Guild* guild, GuildMember* sender, long long db_idx, const std::string& account_id)
{
a8::MutableXObject* prop = a8::MutableXObject::NewObject();
prop->SetVal("gameid", guild->GetGameId());
prop->SetVal("channel", guild->GetChannel());
prop->SetVal("server_instance_id", App::Instance()->instance_id);
prop->SetVal("guild_id", guild->GuildId());
prop->SetVal("guild_name", guild->GuildName());
prop->SetVal("mumber_num", guild->GetMemberNum());
prop->SetVal("sender_account_id", sender->account_id);
prop->SetVal("sender_job", guild->GetMemberJob(sender->account_id));
prop->SetVal("target_account_id", account_id);
f8::TGLog::Instance()->AddTrackLog(guild->GetGameId(),
sender->account_id,
0,
GUILD_REFUSE_EVENT,
prop);
delete prop;
prop = nullptr;
}
void GameLog::GuildAgree(Guild* guild, GuildMember* sender, long long db_idx, const std::string& account_id)
{
a8::MutableXObject* prop = a8::MutableXObject::NewObject();
prop->SetVal("gameid", guild->GetGameId());
prop->SetVal("channel", guild->GetChannel());
prop->SetVal("server_instance_id", App::Instance()->instance_id);
prop->SetVal("guild_id", guild->GuildId());
prop->SetVal("guild_name", guild->GuildName());
prop->SetVal("mumber_num", guild->GetMemberNum());
prop->SetVal("sender_account_id", sender->account_id);
prop->SetVal("sender_job", guild->GetMemberJob(sender->account_id));
prop->SetVal("target_account_id", account_id);
prop->SetVal("db_idx", db_idx);
f8::TGLog::Instance()->AddTrackLog(guild->GetGameId(),
sender->account_id,
0,
GUILD_AGREE_EVENT,
prop);
delete prop;
prop = nullptr;
}
void GameLog::GuildKick(Guild* guild, GuildMember* sender, const std::string& account_id)
{
a8::MutableXObject* prop = a8::MutableXObject::NewObject();
prop->SetVal("gameid", guild->GetGameId());
prop->SetVal("channel", guild->GetChannel());
prop->SetVal("server_instance_id", App::Instance()->instance_id);
prop->SetVal("guild_id", guild->GuildId());
prop->SetVal("guild_name", guild->GuildName());
prop->SetVal("mumber_num", guild->GetMemberNum());
prop->SetVal("sender_account_id", sender->account_id);
prop->SetVal("sender_job", guild->GetMemberJob(sender->account_id));
prop->SetVal("target_account_id", account_id);
prop->SetVal("target_job", guild->GetMemberJob(account_id));
f8::TGLog::Instance()->AddTrackLog(guild->GetGameId(),
sender->account_id,
0,
GUILD_KICK_EVENT,
prop);
delete prop;
prop = nullptr;
}
void GameLog::GuildQuit(Guild* guild, GuildMember* sender)
{
a8::MutableXObject* prop = a8::MutableXObject::NewObject();
prop->SetVal("gameid", guild->GetGameId());
prop->SetVal("channel", guild->GetChannel());
prop->SetVal("server_instance_id", App::Instance()->instance_id);
prop->SetVal("guild_id", guild->GuildId());
prop->SetVal("guild_name", guild->GuildName());
prop->SetVal("mumber_num", guild->GetMemberNum());
prop->SetVal("sender_account_id", sender->account_id);
prop->SetVal("sender_job", guild->GetMemberJob(sender->account_id));
f8::TGLog::Instance()->AddTrackLog(guild->GetGameId(),
sender->account_id,
0,
GUILD_QUIT_EVENT,
prop);
delete prop;
prop = nullptr;
}
void GameLog::GuildSetJob(Guild* guild, GuildMember* sender, int old_job)
{
a8::MutableXObject* prop = a8::MutableXObject::NewObject();
prop->SetVal("gameid", guild->GetGameId());
prop->SetVal("channel", guild->GetChannel());
prop->SetVal("server_instance_id", App::Instance()->instance_id);
prop->SetVal("guild_id", guild->GuildId());
prop->SetVal("guild_name", guild->GuildName());
prop->SetVal("mumber_num", guild->GetMemberNum());
prop->SetVal("sender_account_id", sender->account_id);
prop->SetVal("sender_job", guild->GetMemberJob(sender->account_id));
prop->SetVal("sender_old_job", old_job);
f8::TGLog::Instance()->AddTrackLog(guild->GetGameId(),
sender->account_id,
0,
GUILD_SETJOB_EVENT,
prop);
delete prop;
prop = nullptr;
}
void GameLog::GuildAgreeInvite(Guild* guild, GuildMember* sender)
{
a8::MutableXObject* prop = a8::MutableXObject::NewObject();
prop->SetVal("gameid", guild->GetGameId());
prop->SetVal("channel", guild->GetChannel());
prop->SetVal("server_instance_id", App::Instance()->instance_id);
prop->SetVal("guild_id", guild->GuildId());
prop->SetVal("guild_name", guild->GuildName());
prop->SetVal("mumber_num", guild->GetMemberNum());
prop->SetVal("sender_account_id", sender->account_id);
prop->SetVal("sender_job", guild->GetMemberJob(sender->account_id));
f8::TGLog::Instance()->AddTrackLog(guild->GetGameId(),
sender->account_id,
0,
GUILD_AGREE_INVITE_EVENT,
prop);
delete prop;
prop = nullptr;
}

View File

@ -31,10 +31,14 @@ public:
void _CMGuildAgreeInvite(f8::MsgHdr& hdr, const cs::CMGuildAgreeInvite& msg);
long long GuildId() { return guild_id_; }
const std::string GuildName() { return guild_name_; }
int GetMemberJob(const std::string& account_id);
int Status() { return guild_status_; }
int GetGameId() { return gameid_; }
int GetChannel() { return channel_; }
std::set<std::string>* GetJobMembers(int job);
int GetJobMemberNum(int job);
int GetMemberNum();
void UpdateMemberInfo(const cs::MFUserInfo& user_info);
void UpdateMemberOnline(const std::string& account_id);
void UpdateMemberOffline(const std::string& account_id);
@ -59,7 +63,6 @@ private:
void SerializeMembers(std::string& guild_members);
void SaveToDB();
void GenSortedMembers();
int GetMemberNum();
void FillApplyList(const std::string& account_id, cs::MFPaging& paging, cs::SMGuildApplyList& respmsg);
void ClearApplyBySenderId(const std::string& sender_id);
void ClearApplyByIdx(long long idx);