1
This commit is contained in:
parent
a7fc4d6866
commit
94ff78d023
@ -808,6 +808,14 @@ void Guild::UpdateMemberOffline(const std::string& account_id)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Guild::Active()
|
||||||
|
{
|
||||||
|
if (App::Instance()->nowtime - last_query_member_time_ > 15) {
|
||||||
|
QueryMemberOnlineState();
|
||||||
|
last_query_member_time_ = App::Instance()->nowtime;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int Guild::GetJobMemberNum(int job)
|
int Guild::GetJobMemberNum(int job)
|
||||||
{
|
{
|
||||||
std::set<std::string>* members = GetJobMembers(job);
|
std::set<std::string>* members = GetJobMembers(job);
|
||||||
@ -1058,6 +1066,20 @@ void Guild::SendErrorMsg(int socket_handle, const ss::MFIMMsgConext& context, co
|
|||||||
notifymsg);
|
notifymsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Guild::QueryMemberOnlineState()
|
||||||
|
{
|
||||||
|
ss::SS_GS_QueryGuildUserOnlineState msg;
|
||||||
|
msg.set_seqid(App::Instance()->NewUUID());
|
||||||
|
msg.set_guild_id(GuildId());
|
||||||
|
for (auto& pair : member_hash_) {
|
||||||
|
GuildMember* member = pair.second;
|
||||||
|
if (App::Instance()->nowtime - member->last_update_time > 30) {
|
||||||
|
msg.add_account_ids(member->account_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
GuildMgr::Instance()->SendMsg(0, msg);
|
||||||
|
}
|
||||||
|
|
||||||
void Guild::GenGuildData(Player* hum, long long guild_id, std::string& guild_data)
|
void Guild::GenGuildData(Player* hum, long long guild_id, std::string& guild_data)
|
||||||
{
|
{
|
||||||
ss::MFGuildDB guild_db;
|
ss::MFGuildDB guild_db;
|
||||||
|
@ -37,6 +37,7 @@ public:
|
|||||||
void UpdateMemberInfo(const cs::MFUserInfo& user_info);
|
void UpdateMemberInfo(const cs::MFUserInfo& user_info);
|
||||||
void UpdateMemberOnline(const std::string& account_id);
|
void UpdateMemberOnline(const std::string& account_id);
|
||||||
void UpdateMemberOffline(const std::string& account_id);
|
void UpdateMemberOffline(const std::string& account_id);
|
||||||
|
void Active();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool IsFull();
|
bool IsFull();
|
||||||
@ -60,6 +61,7 @@ private:
|
|||||||
const std::string& guild_members,
|
const std::string& guild_members,
|
||||||
const std::string& guild_log);
|
const std::string& guild_log);
|
||||||
void SendErrorMsg(int sokcet_handle, const ss::MFIMMsgConext& context, const std::string& errmsg);
|
void SendErrorMsg(int sokcet_handle, const ss::MFIMMsgConext& context, const std::string& errmsg);
|
||||||
|
void QueryMemberOnlineState();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool dirty_ = false;
|
bool dirty_ = false;
|
||||||
@ -94,6 +96,7 @@ private:
|
|||||||
int join_cond2_ = 0;
|
int join_cond2_ = 0;
|
||||||
int createtime_ = 0;
|
int createtime_ = 0;
|
||||||
|
|
||||||
|
time_t last_query_member_time_ = 0;
|
||||||
a8::TimerAttacher timer_attacher_;
|
a8::TimerAttacher timer_attacher_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -44,6 +44,7 @@ public:
|
|||||||
hdr.offset = 0;
|
hdr.offset = 0;
|
||||||
hdr.hum = nullptr;
|
hdr.hum = nullptr;
|
||||||
hdr.user_data = &forward_msg;
|
hdr.user_data = &forward_msg;
|
||||||
|
guild->Active();
|
||||||
ProcessNetMsg(handler, guild, hdr);
|
ProcessNetMsg(handler, guild, hdr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -283,3 +284,32 @@ void GuildMgr::ForwardGuildSMMsg(int socket_handle,
|
|||||||
IMListener::Instance()->SendMsg(socket_handle, msg);
|
IMListener::Instance()->SendMsg(socket_handle, msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GuildMgr::SendMsg(int socket_handle,
|
||||||
|
int msgid,
|
||||||
|
const ::google::protobuf::Message& msg)
|
||||||
|
{
|
||||||
|
if (socket_handle == 0) {
|
||||||
|
int packlen = msg.ByteSize();
|
||||||
|
char* buff = nullptr;
|
||||||
|
if (packlen > 0) {
|
||||||
|
buff = (char*)malloc(packlen);
|
||||||
|
msg.SerializeToArray(buff, packlen);
|
||||||
|
}
|
||||||
|
App::Instance()->AddSocketMsg
|
||||||
|
(
|
||||||
|
SF_IMServer,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
msgid,
|
||||||
|
0,
|
||||||
|
buff,
|
||||||
|
packlen
|
||||||
|
);
|
||||||
|
if (buff) {
|
||||||
|
free(buff);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
IMListener::Instance()->SendMsg(socket_handle, msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -35,6 +35,15 @@ class GuildMgr : public a8::Singleton<GuildMgr>
|
|||||||
const ss::MFIMMsgConext& context,
|
const ss::MFIMMsgConext& context,
|
||||||
int msgid,
|
int msgid,
|
||||||
const ::google::protobuf::Message& smmsg);
|
const ::google::protobuf::Message& smmsg);
|
||||||
|
template <typename T>
|
||||||
|
void SendMsg(int socket_handle, T& msg)
|
||||||
|
{
|
||||||
|
static int msgid = f8::Net_GetMessageId(msg);
|
||||||
|
SendMsg(socket_handle, msgid, msg);
|
||||||
|
}
|
||||||
|
void SendMsg(int socket_handle,
|
||||||
|
int msgid,
|
||||||
|
const ::google::protobuf::Message& msg);
|
||||||
void _SS_IM_ForwardGuildCMMsg(f8::MsgHdr& hdr, const ss::SS_IM_ForwardGuildCMMsg& msg);
|
void _SS_IM_ForwardGuildCMMsg(f8::MsgHdr& hdr, const ss::SS_IM_ForwardGuildCMMsg& msg);
|
||||||
void _SS_IM_ForwardGuildSMMsg(f8::MsgHdr& hdr, const ss::SS_IM_ForwardGuildSMMsg& msg);
|
void _SS_IM_ForwardGuildSMMsg(f8::MsgHdr& hdr, const ss::SS_IM_ForwardGuildSMMsg& msg);
|
||||||
void _SS_IM_RefeshGuildMemberInfo(f8::MsgHdr& hdr, const ss::SS_IM_RefeshGuildMemberInfo& msg);
|
void _SS_IM_RefeshGuildMemberInfo(f8::MsgHdr& hdr, const ss::SS_IM_RefeshGuildMemberInfo& msg);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user