1
This commit is contained in:
parent
8f80a17088
commit
09d8bbf366
@ -675,6 +675,9 @@ void Player::FillApplyList(const cs::MFPaging& paging, cs::SMFriendApplyList& re
|
|||||||
int start = paging.curr_page() * paging.page_size();
|
int start = paging.curr_page() * paging.page_size();
|
||||||
for (auto& pair : apply_hash_) {
|
for (auto& pair : apply_hash_) {
|
||||||
if (i >= start && i < start + paging.page_size()) {
|
if (i >= start && i < start + paging.page_size()) {
|
||||||
|
if (pair.second->flag == 1) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
TypeConvert::Convert(*pair.second, *respmsg.add_apply_list());
|
TypeConvert::Convert(*pair.second, *respmsg.add_apply_list());
|
||||||
}
|
}
|
||||||
++i;
|
++i;
|
||||||
@ -1157,11 +1160,11 @@ void Player::RefreshFriendData()
|
|||||||
void Player::RemoveHandledApply()
|
void Player::RemoveHandledApply()
|
||||||
{
|
{
|
||||||
std::vector<long long> handled_idxs;
|
std::vector<long long> handled_idxs;
|
||||||
for (auto& pair : apply_hash_) {
|
for (auto& pair : apply_hash_) {
|
||||||
if (GetFriendById(pair.second->base_data.account_id)) {
|
if (GetFriendById(pair.second->base_data.account_id)) {
|
||||||
handled_idxs.push_back(pair.first);
|
handled_idxs.push_back(pair.first);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (long long idx : handled_idxs) {
|
for (long long idx : handled_idxs) {
|
||||||
auto itr = apply_hash_.find(idx);
|
auto itr = apply_hash_.find(idx);
|
||||||
if (itr != apply_hash_.end()) {
|
if (itr != apply_hash_.end()) {
|
||||||
@ -1178,6 +1181,25 @@ void Player::RemoveHandledApply()
|
|||||||
apply_hash_.erase(itr);
|
apply_hash_.erase(itr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
CombineRepeatApply();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Player::CombineRepeatApply()
|
||||||
|
{
|
||||||
|
std::map<std::string, std::vector<FriendApply*>> 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<FriendApply*>({pair.second});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (auto& pair : num_hash) {
|
||||||
|
for (size_t i = 0; i + 1 < pair.second.size(); ++i) {
|
||||||
|
pair.second[i]->flag = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::QueryUserOnline(std::vector<std::string> account_ids)
|
void Player::QueryUserOnline(std::vector<std::string> account_ids)
|
||||||
@ -1247,3 +1269,4 @@ void Player::QueryUserFromDB()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,6 +135,7 @@ private:
|
|||||||
void ClearApplyBySenderId(const std::string& sender_id);
|
void ClearApplyBySenderId(const std::string& sender_id);
|
||||||
void RefreshFriendData();
|
void RefreshFriendData();
|
||||||
void RemoveHandledApply();
|
void RemoveHandledApply();
|
||||||
|
void CombineRepeatApply();
|
||||||
void QueryUserOnline(std::vector<std::string> account_ids);
|
void QueryUserOnline(std::vector<std::string> account_ids);
|
||||||
void QueryUserFromDB();
|
void QueryUserFromDB();
|
||||||
|
|
||||||
|
@ -51,6 +51,7 @@ struct FriendApply
|
|||||||
long long applyid = 0;
|
long long applyid = 0;
|
||||||
std::string target_id;
|
std::string target_id;
|
||||||
BaseUserData base_data;
|
BaseUserData base_data;
|
||||||
|
int flag = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Event
|
struct Event
|
||||||
|
Loading…
x
Reference in New Issue
Block a user