1
This commit is contained in:
parent
fd200df692
commit
1afd961b73
@ -47,7 +47,7 @@ const char* const EVENT_FRIEND_DELETE = "friend.delete";
|
||||
|
||||
const int MAX_INSTANCE_ID = 1023;
|
||||
|
||||
const int MAX_FRIEND_NUM = 50;
|
||||
const int MAX_FRIEND_NUM = 30;
|
||||
const int DAILY_JOIN_FRIEND_TIMES = 100;
|
||||
const int DAILY_APPLY_FRIEND_TIMES = 100;
|
||||
|
||||
|
@ -489,7 +489,7 @@ void Player::_SS_IM_FriendAgreeRequest(f8::MsgHdr& hdr, const ss::SS_IM_FriendAg
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
RemoveHandledApply();
|
||||
f8::MsgHdr* hdr_copy = hdr.Clone();
|
||||
ss::SS_IM_FriendAgreeRequest* msg_copy = new ss::SS_IM_FriendAgreeRequest;
|
||||
*msg_copy = msg;
|
||||
@ -668,6 +668,7 @@ Friend* Player::GetFriendById(const std::string& friend_id)
|
||||
|
||||
void Player::FillApplyList(const cs::MFPaging& paging, cs::SMFriendApplyList& respmsg)
|
||||
{
|
||||
RemoveHandledApply();
|
||||
int i = 0;
|
||||
int start = paging.curr_page() * paging.page_size();
|
||||
for (auto& pair : apply_hash_) {
|
||||
@ -1155,3 +1156,29 @@ void Player::RefreshFriendData()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Player::RemoveHandledApply()
|
||||
{
|
||||
std::vector<long long> handled_idxs;
|
||||
for (auto& pair : apply_hash_) {
|
||||
if (GetFriendById(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()->SetFriendApplyStatus
|
||||
(
|
||||
myself.crc32_code,
|
||||
apply->idx,
|
||||
apply->base_data.account_id,
|
||||
AccountId(),
|
||||
3
|
||||
);
|
||||
delete itr->second;
|
||||
apply_hash_.erase(itr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -134,6 +134,7 @@ private:
|
||||
void ClearApplyByIdx(long long idx);
|
||||
void ClearApplyByTarget(const std::string& target_id);
|
||||
void RefreshFriendData();
|
||||
void RemoveHandledApply();
|
||||
|
||||
private:
|
||||
bool dirty_ = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user