This commit is contained in:
aozhiwei 2020-06-23 13:11:34 +08:00
parent 6cc95f43f6
commit 9f4c0e5caf
2 changed files with 17 additions and 18 deletions

View File

@ -191,21 +191,21 @@ void Player::_CMFriendApplyList(f8::MsgHdr& hdr, const cs::CMFriendApplyList& ms
Player* hum = PlayerMgr::Instance()->GetPlayerByAccountId(param.sender.GetString());
if (hum && hum->socket_handle == param.param1.GetInt()) {
for (auto& row : *data_set) {
FriendApply apply;
apply.idx = a8::XValue(row[0]);
apply.applyid = a8::XValue(row[1]);
apply.target_id = row[2];
apply.base_data.account_id = row[3];
apply.base_data.nickname = row[4];
apply.base_data.avatar_url = row[5];
apply.base_data.sex = a8::XValue(row[6]);
apply.base_data.base_data_version = a8::XValue(row[7]);
apply.base_data.user_value1 = a8::XValue(row[8]);
apply.base_data.user_value2 = a8::XValue(row[9]);
apply.base_data.user_value3 = a8::XValue(row[10]);
hum->apply_list_.push_back(apply);
if (apply.idx > hum->last_apply_idx_) {
hum->last_apply_idx_ = apply.idx;
FriendApply* apply = new FriendApply;
apply->idx = a8::XValue(row[0]);
apply->applyid = a8::XValue(row[1]);
apply->target_id = row[2];
apply->base_data.account_id = row[3];
apply->base_data.nickname = row[4];
apply->base_data.avatar_url = row[5];
apply->base_data.sex = a8::XValue(row[6]);
apply->base_data.base_data_version = a8::XValue(row[7]);
apply->base_data.user_value1 = a8::XValue(row[8]);
apply->base_data.user_value2 = a8::XValue(row[9]);
apply->base_data.user_value3 = a8::XValue(row[10]);
hum->apply_hash_[apply->idx] = apply;
if (apply->idx > hum->last_apply_idx_) {
hum->last_apply_idx_ = apply->idx;
}
}
cs::SMFriendApplyList respmsg;
@ -660,9 +660,9 @@ void Player::FillApplyList(const cs::MFPaging& paging, cs::SMFriendApplyList& re
{
int i = 0;
int start = paging.curr_page() * paging.page_size();
for (const FriendApply& apply : apply_list_) {
for (auto& pair : apply_hash_) {
if (i >= start && i < start + paging.page_size()) {
TypeConvert::Convert(apply, *respmsg.add_apply_list());
TypeConvert::Convert(*pair.second, *respmsg.add_apply_list());
}
++i;
}

View File

@ -148,5 +148,4 @@ private:
std::map<std::string, Friend*> friend_hash_;
std::map<long long, FriendApply*> apply_hash_;
std::list<FriendApply> apply_list_;
};