1
This commit is contained in:
parent
8fb1ed53b1
commit
3080d505e1
@ -1115,9 +1115,7 @@ int Guild::GetMemberNum()
|
||||
|
||||
void Guild::FillApplyList(const std::string& account_id, cs::MFPaging& paging, cs::SMGuildApplyList& respmsg)
|
||||
{
|
||||
#if 0
|
||||
RemoveHandledApply();
|
||||
#endif
|
||||
int i = 0;
|
||||
int start = paging.curr_page() * paging.page_size();
|
||||
for (auto& pair : apply_hash_) {
|
||||
@ -1306,3 +1304,46 @@ void Guild::GuildRenameCb(int socket_handle, const ss::MFIMMsgConext& context, c
|
||||
respmsg);
|
||||
MarkDirty();
|
||||
}
|
||||
|
||||
void Guild::RemoveHandledApply()
|
||||
{
|
||||
std::vector<long long> handled_idxs;
|
||||
for (auto& pair : apply_hash_) {
|
||||
if (GetMember(pair.second->base_data.account_id)) {
|
||||
handled_idxs.push_back(pair.first);
|
||||
}
|
||||
}
|
||||
for (long long idx : handled_idxs) {
|
||||
auto itr = apply_hash_.find(idx);
|
||||
if (itr != apply_hash_.end()) {
|
||||
auto& apply = itr->second;
|
||||
DBHelper::Instance()->SetGuildApplyStatus
|
||||
(
|
||||
apply->base_data.account_id,
|
||||
guild_id_,
|
||||
kGuildApplyIgnore
|
||||
);
|
||||
delete itr->second;
|
||||
apply_hash_.erase(itr);
|
||||
}
|
||||
}
|
||||
CombineRepeatApply();
|
||||
}
|
||||
|
||||
void Guild::CombineRepeatApply()
|
||||
{
|
||||
std::map<std::string, std::vector<GuildApply*>> num_hash;
|
||||
for (auto& pair : apply_hash_) {
|
||||
auto itr = num_hash.find(pair.second->base_data.account_id);
|
||||
if (itr != num_hash.end()) {
|
||||
itr->second.push_back(pair.second);
|
||||
} else {
|
||||
num_hash[pair.second->base_data.account_id] = std::vector<GuildApply*>({pair.second});
|
||||
}
|
||||
}
|
||||
for (auto& pair : num_hash) {
|
||||
for (size_t i = 0; i + 1 < pair.second.size(); ++i) {
|
||||
pair.second[i]->flag = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -67,6 +67,8 @@ private:
|
||||
void QueryMemberOnlineState();
|
||||
GuildMember* ChooseLeader(std::set<std::string>* members);
|
||||
void GuildRenameCb(int socket_handle, const ss::MFIMMsgConext& context, const cs::CMGuildChange& msg);
|
||||
void RemoveHandledApply();
|
||||
void CombineRepeatApply();
|
||||
|
||||
private:
|
||||
bool dirty_ = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user