1
This commit is contained in:
parent
d830a98ddf
commit
04bd31d0d5
@ -179,7 +179,7 @@ void DBHelper::AddGuildApply(Guild* guild, const cs::MFUserInfo& user_info)
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
a8::XObject conn_info = DBEngine::Instance()->GetConnInfo(guild->guild_id);
|
a8::XObject conn_info = DBEngine::Instance()->GetConnInfo(guild->GuildId());
|
||||||
DBEngine::Instance()->ExecAsyncScript
|
DBEngine::Instance()->ExecAsyncScript
|
||||||
(
|
(
|
||||||
conn_info,
|
conn_info,
|
||||||
@ -189,7 +189,7 @@ void DBHelper::AddGuildApply(Guild* guild, const cs::MFUserInfo& user_info)
|
|||||||
"VALUES(%d, '%s', '%s', '%s', '%s', %d, %d, %d, %d, %d, %d, 0);",
|
"VALUES(%d, '%s', '%s', '%s', '%s', %d, %d, %d, %d, %d, %d, 0);",
|
||||||
{
|
{
|
||||||
App::Instance()->NewUUID(),
|
App::Instance()->NewUUID(),
|
||||||
guild->guild_id,
|
guild->GuildId(),
|
||||||
user_info.base_data().account_id(),
|
user_info.base_data().account_id(),
|
||||||
user_info.base_data().nickname(),
|
user_info.base_data().nickname(),
|
||||||
user_info.base_data().avatar_url(),
|
user_info.base_data().avatar_url(),
|
||||||
@ -201,10 +201,10 @@ void DBHelper::AddGuildApply(Guild* guild, const cs::MFUserInfo& user_info)
|
|||||||
user_info.base_data().user_value3()
|
user_info.base_data().user_value3()
|
||||||
},
|
},
|
||||||
a8::XParams()
|
a8::XParams()
|
||||||
.SetSender(guild->guild_id),
|
.SetSender(guild->GuildId()),
|
||||||
on_ok,
|
on_ok,
|
||||||
on_error,
|
on_error,
|
||||||
guild->guild_id
|
guild->GuildId()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,10 +27,11 @@ void Guild::UnInit()
|
|||||||
delete pair.second;
|
delete pair.second;
|
||||||
}
|
}
|
||||||
member_hash_.clear();
|
member_hash_.clear();
|
||||||
A8_SAFE_DELETE(logdb_);
|
|
||||||
for (auto& pair : apply_hash_) {
|
for (auto& pair : apply_hash_) {
|
||||||
delete pair.second;
|
delete pair.second;
|
||||||
}
|
}
|
||||||
|
apply_hash_.clear();
|
||||||
|
A8_SAFE_DELETE(logdb_);
|
||||||
}
|
}
|
||||||
|
|
||||||
GuildMember* Guild::GetMember(const std::string& account_id)
|
GuildMember* Guild::GetMember(const std::string& account_id)
|
||||||
@ -95,7 +96,7 @@ void Guild::MarkDirty()
|
|||||||
Guild* guild = (Guild*)param.sender.GetUserData();
|
Guild* guild = (Guild*)param.sender.GetUserData();
|
||||||
guild->SaveToDB();
|
guild->SaveToDB();
|
||||||
},
|
},
|
||||||
&timer_attacher.timer_list_,
|
&timer_attacher_.timer_list_,
|
||||||
[] (const a8::XParams& param)
|
[] (const a8::XParams& param)
|
||||||
{
|
{
|
||||||
Guild* guild = (Guild*)param.sender.GetUserData();
|
Guild* guild = (Guild*)param.sender.GetUserData();
|
||||||
|
@ -36,28 +36,9 @@ class Guild
|
|||||||
public:
|
public:
|
||||||
enum { HID = HID_Guild };
|
enum { HID = HID_Guild };
|
||||||
public:
|
public:
|
||||||
int gameid = 0;
|
|
||||||
long long guild_id = 0;
|
|
||||||
std::string guild_name;
|
|
||||||
int guild_lv = 0;
|
|
||||||
int guild_exp = 0;
|
|
||||||
int guild_badge = 0;
|
|
||||||
int guild_apply_num = 0;
|
|
||||||
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;
|
|
||||||
|
|
||||||
void Init();
|
void Init();
|
||||||
void UnInit();
|
void UnInit();
|
||||||
void MarkDirty();
|
|
||||||
void Deserialize(const std::string& guild_data, const std::string& guild_log);
|
void Deserialize(const std::string& guild_data, const std::string& guild_log);
|
||||||
|
|
||||||
void _CMGuildInfo(f8::MsgHdr& hdr, const cs::CMGuildInfo& msg);
|
void _CMGuildInfo(f8::MsgHdr& hdr, const cs::CMGuildInfo& msg);
|
||||||
@ -71,8 +52,11 @@ public:
|
|||||||
void _CMGuildApplyList(f8::MsgHdr& hdr, const cs::CMGuildApplyList& msg);
|
void _CMGuildApplyList(f8::MsgHdr& hdr, const cs::CMGuildApplyList& msg);
|
||||||
void _CMGuildLog(f8::MsgHdr& hdr, const cs::CMGuildLog& msg);
|
void _CMGuildLog(f8::MsgHdr& hdr, const cs::CMGuildLog& msg);
|
||||||
|
|
||||||
|
long long GuildId() { return guild_id; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool IsFull();
|
bool IsFull();
|
||||||
|
void MarkDirty();
|
||||||
GuildMember* GetMember(const std::string& account_id);
|
GuildMember* GetMember(const std::string& account_id);
|
||||||
void AddMember(GuildMember* member);
|
void AddMember(GuildMember* member);
|
||||||
void RemoveMember(const std::string& sender_id,
|
void RemoveMember(const std::string& sender_id,
|
||||||
@ -97,4 +81,26 @@ private:
|
|||||||
std::vector<GuildMember*> sorted_members_;
|
std::vector<GuildMember*> sorted_members_;
|
||||||
ss::MFGuildLogDB* logdb_ = nullptr;
|
ss::MFGuildLogDB* logdb_ = nullptr;
|
||||||
std::map<long long, GuildApply*> apply_hash_;
|
std::map<long long, GuildApply*> apply_hash_;
|
||||||
|
|
||||||
|
int gameid = 0;
|
||||||
|
long long guild_id = 0;
|
||||||
|
std::string guild_name;
|
||||||
|
int guild_lv = 0;
|
||||||
|
int guild_exp = 0;
|
||||||
|
int guild_badge = 0;
|
||||||
|
int guild_apply_num = 0;
|
||||||
|
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_;
|
||||||
|
|
||||||
|
friend class GuildMgr;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user