This commit is contained in:
aozhiwei 2020-09-25 14:12:04 +08:00
parent 13b48a5a91
commit e5c90e2642
3 changed files with 36 additions and 0 deletions

View File

@ -27,6 +27,9 @@ void Guild::UnInit()
} }
member_hash_.clear(); member_hash_.clear();
A8_SAFE_DELETE(logdb_); A8_SAFE_DELETE(logdb_);
for (auto& pair : apply_hash_) {
delete pair.second;
}
} }
GuildMember* Guild::GetMember(const std::string& account_id) GuildMember* Guild::GetMember(const std::string& account_id)
@ -168,6 +171,14 @@ void Guild::_CMGuildAgree(f8::MsgHdr& hdr, const cs::CMGuildAgree& msg)
GuildMember* member = new GuildMember(); GuildMember* member = new GuildMember();
TypeConvert::Convert(forward_msg->context().user_info().base_data(), *member); TypeConvert::Convert(forward_msg->context().user_info().base_data(), *member);
AddMember(member); AddMember(member);
DBHelper::Instance()->SetGuildApplyStatus
(
msg.apply().base_data().account_id(),
guild_id,
1
);
ClearApplyBySenderId(msg.apply().base_data().account_id());
} }
} }
@ -520,3 +531,25 @@ void Guild::FillApplyList(const std::string& account_id, cs::MFPaging& paging, c
respmsg.mutable_paging()->set__total_page(1); respmsg.mutable_paging()->set__total_page(1);
} }
} }
void Guild::ClearApplyBySenderId(const std::string& sender_id)
{
std::vector<long long> deleted_applys;
for (auto& pair : apply_hash_) {
if (pair.second->base_data.account_id == sender_id) {
deleted_applys.push_back(pair.first);
}
}
for (auto idx : deleted_applys) {
ClearApplyByIdx(idx);
}
}
void Guild::ClearApplyByIdx(long long idx)
{
auto itr = apply_hash_.find(idx);
if (itr != apply_hash_.end()) {
delete itr->second;
apply_hash_.erase(itr);
}
}

View File

@ -84,6 +84,8 @@ private:
void GenSortedMembers(); void GenSortedMembers();
int GetMemberNum(); int GetMemberNum();
void FillApplyList(const std::string& account_id, cs::MFPaging& paging, cs::SMGuildApplyList& respmsg); void FillApplyList(const std::string& account_id, cs::MFPaging& paging, cs::SMGuildApplyList& respmsg);
void ClearApplyBySenderId(const std::string& sender_id);
void ClearApplyByIdx(long long idx);
private: private:
bool dirty_ = false; bool dirty_ = false;

View File

@ -390,6 +390,7 @@ message SMGuildJoin
// //
message CMGuildAgree message CMGuildAgree
{ {
optional MFGuildApply apply = 1; //
} }
message SMGuildAgree message SMGuildAgree
{ {