1
This commit is contained in:
parent
1d5e51fad3
commit
f70f76a135
@ -1,5 +1,7 @@
|
||||
#include "precompile.h"
|
||||
|
||||
#include <a8/openssl.h>
|
||||
|
||||
#include "guild.h"
|
||||
#include "guildmgr.h"
|
||||
#include "cs_msgid.pb.h"
|
||||
@ -7,6 +9,7 @@
|
||||
#include "ss_proto.pb.h"
|
||||
#include "IMListener.h"
|
||||
#include "asynctaskmgr.h"
|
||||
#include "dbengine.h"
|
||||
|
||||
class AsyncGuildTask
|
||||
{
|
||||
@ -237,6 +240,17 @@ void GuildMgr::_SS_IM_ForwardGuildCMMsg(f8::MsgHdr& hdr, const ss::SS_IM_Forward
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int GuildMgr::GetGuildCrc32(long long guild_id)
|
||||
{
|
||||
std::string guild_id_str = a8::XValue(guild_id).GetString();
|
||||
unsigned int crc32_code = a8::openssl::Crc32
|
||||
(
|
||||
(unsigned char*)guild_id_str.data(),
|
||||
guild_id_str.size()
|
||||
);
|
||||
return crc32_code;
|
||||
}
|
||||
|
||||
void GuildMgr::_CMGuildCreate(int socket_handle, const ss::MFIMMsgConext& context, const cs::CMGuildCreate& msg)
|
||||
{
|
||||
Guild* guild = GetGuild(context.user_info().base_data().guild_id());
|
||||
@ -289,6 +303,32 @@ void GuildMgr::LoadGuild(long long guild_id)
|
||||
return;
|
||||
}
|
||||
pending_guild_hash_.insert(guild_id);
|
||||
|
||||
auto on_ok =
|
||||
[] (a8::XParams& param, const f8::DataSet* data_set)
|
||||
{
|
||||
if (data_set) {
|
||||
}
|
||||
};
|
||||
auto on_error =
|
||||
[] (a8::XParams& param, int error_code, const std::string& error_msg)
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
a8::XObject conn_info = DBEngine::Instance()->GetConnInfo(GetGuildCrc32(guild_id));
|
||||
DBEngine::Instance()->ExecAsyncQuery
|
||||
(
|
||||
conn_info,
|
||||
"",
|
||||
{
|
||||
|
||||
},
|
||||
a8::XParams(),
|
||||
on_ok,
|
||||
on_error,
|
||||
GetGuildCrc32(guild_id)
|
||||
);
|
||||
}
|
||||
|
||||
bool GuildMgr::IsValidGuildId(long long guild_id)
|
||||
|
@ -39,6 +39,7 @@ class GuildMgr : public a8::Singleton<GuildMgr>
|
||||
int msgid,
|
||||
const ::google::protobuf::Message& smmsg);
|
||||
void _SS_IM_ForwardGuildCMMsg(f8::MsgHdr& hdr, const ss::SS_IM_ForwardGuildCMMsg& msg);
|
||||
unsigned int GetGuildCrc32(long long guild_id);
|
||||
|
||||
private:
|
||||
void _CMGuildCreate(int socket_handle, const ss::MFIMMsgConext& context, const cs::CMGuildCreate& msg);
|
||||
|
Loading…
x
Reference in New Issue
Block a user