1
This commit is contained in:
parent
d636f8e31e
commit
7e139d9d62
@ -41,6 +41,7 @@ struct timer_list;
|
||||
class Guild
|
||||
{
|
||||
public:
|
||||
int gameid = 0;
|
||||
long long guild_id = 0;
|
||||
std::string guild_name;
|
||||
int guild_lv = 0;
|
||||
@ -50,7 +51,11 @@ class Guild
|
||||
std::string guild_notice;
|
||||
std::string guild_declaration;
|
||||
std::string owner_id;
|
||||
std::string owner_name;
|
||||
std::string owner_avatar_url;
|
||||
std::string creator_id;
|
||||
std::string creator_name;
|
||||
std::string creator_avatar_url;
|
||||
int guild_status = 0;
|
||||
int createtime = 0;
|
||||
a8::TimerAttacher timer_attacher;
|
||||
|
@ -309,6 +309,32 @@ void GuildMgr::LoadGuild(long long guild_id)
|
||||
{
|
||||
GuildMgr::Instance()->pending_guild_hash_.erase(param.sender);
|
||||
if (data_set) {
|
||||
for (auto& row : *data_set) {
|
||||
GuildMgr::Instance()->CreateGuild
|
||||
(
|
||||
a8::XValue(row[0]), //gameid
|
||||
a8::XValue(row[1]), //guild_id
|
||||
row[3], //guild_name
|
||||
a8::XValue(row[4]), //guild_lv
|
||||
a8::XValue(row[5]), //guild_exp
|
||||
a8::XValue(row[6]), //guild_badge
|
||||
a8::XValue(row[7]), //guild_apply_num
|
||||
row[8], //guild_administers
|
||||
row[9], //guild_notice
|
||||
row[10], //guild_declaration
|
||||
row[11], //guild_log
|
||||
row[12], //owner_id
|
||||
row[13], //owner_name
|
||||
row[14], //owner_avatar_url
|
||||
row[15], //creator_id
|
||||
row[16], //creator_name
|
||||
row[17], //creator_avatar_url
|
||||
row[18], //guild_data
|
||||
a8::XValue(19), //guild_status
|
||||
a8::XValue(20) //createtime
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
auto on_error =
|
||||
@ -319,7 +345,9 @@ void GuildMgr::LoadGuild(long long guild_id)
|
||||
if (itr != GuildMgr::Instance()->task_hash_.end()) {
|
||||
for (auto task : itr->second) {
|
||||
task->OnError();
|
||||
delete task;
|
||||
}
|
||||
GuildMgr::Instance()->task_hash_.erase(itr);
|
||||
}
|
||||
};
|
||||
|
||||
@ -328,8 +356,9 @@ void GuildMgr::LoadGuild(long long guild_id)
|
||||
(
|
||||
conn_info,
|
||||
"SELECT gameid, guild_id, guild_name, guild_lv, guild_exp, guild_badge, guild_apply_num, "
|
||||
" guild_administers, guild_notice, guild_declaration, guild_log, owner_id, owner_name, "
|
||||
" creator_id, guild_data, guild_status, createtime "
|
||||
" guild_administers, guild_notice, guild_declaration, guild_log, "
|
||||
" owner_id, owner_name, owner_avatar_url, "
|
||||
" creator_id, creator_name, creator_avatar_url, guild_data, guild_status, createtime "
|
||||
"WHERE guild_id=%d;",
|
||||
{
|
||||
guild_id
|
||||
@ -365,7 +394,7 @@ void GuildMgr::ForwardGuildSMMsg(int socket_handle,
|
||||
IMListener::Instance()->SendMsg(socket_handle, msg);
|
||||
}
|
||||
|
||||
Guild* GuildMgr::CreateGuild(int gameid,
|
||||
void GuildMgr::CreateGuild(int gameid,
|
||||
long long guild_id,
|
||||
const std::string& guild_name,
|
||||
int guild_lv,
|
||||
@ -378,11 +407,35 @@ Guild* GuildMgr::CreateGuild(int gameid,
|
||||
const std::string& guild_log,
|
||||
const std::string& owner_id,
|
||||
const std::string& owner_name,
|
||||
const std::string& owner_avatar_url,
|
||||
const std::string& creator_id,
|
||||
const std::string& creator_name,
|
||||
const std::string& creator_avatar_url,
|
||||
const std::string& guild_data,
|
||||
int guild_status,
|
||||
int createtime
|
||||
)
|
||||
{
|
||||
return nullptr;
|
||||
if (GetGuild(guild_id)) {
|
||||
abort();
|
||||
}
|
||||
Guild* guild = new Guild;
|
||||
guild->gameid = gameid;
|
||||
guild->guild_id = guild_id;
|
||||
guild->guild_name = guild_name;
|
||||
guild->guild_lv = guild_lv;
|
||||
guild->guild_exp = guild_exp;
|
||||
guild->guild_badge = guild_badge;
|
||||
guild->guild_apply_num = guild_apply_num;
|
||||
guild->guild_notice = guild_notice;
|
||||
guild->guild_declaration = guild_declaration;
|
||||
guild->owner_id = owner_id;
|
||||
guild->owner_name = owner_name;
|
||||
guild->owner_avatar_url = owner_avatar_url;
|
||||
guild->creator_id = creator_id;
|
||||
guild->creator_name = creator_name;
|
||||
guild->creator_avatar_url = creator_avatar_url;
|
||||
guild->guild_status = guild_status;
|
||||
guild->createtime = createtime;
|
||||
id_hash_[guild_id] = guild;
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ class GuildMgr : public a8::Singleton<GuildMgr>
|
||||
void LoadGuild(long long guild_id);
|
||||
bool IsValidGuildId(long long guild_id);
|
||||
Guild* GetGuild(long long guild_id);
|
||||
Guild* CreateGuild(int gameid,
|
||||
void CreateGuild(int gameid,
|
||||
long long guild_id,
|
||||
const std::string& guild_name,
|
||||
int guild_lv,
|
||||
@ -63,7 +63,10 @@ class GuildMgr : public a8::Singleton<GuildMgr>
|
||||
const std::string& guild_log,
|
||||
const std::string& owner_id,
|
||||
const std::string& owner_name,
|
||||
const std::string& owner_avatar_url,
|
||||
const std::string& creator_id,
|
||||
const std::string& creator_name,
|
||||
const std::string& creator_avatar_url,
|
||||
const std::string& guild_data,
|
||||
int guild_status,
|
||||
int createtime
|
||||
|
Loading…
x
Reference in New Issue
Block a user