This commit is contained in:
aozhiwei 2020-11-20 11:08:18 +08:00
parent ab417d3fab
commit 7fed4537f8

View File

@ -61,18 +61,22 @@ struct RecommandFriendTask
if (context.IsValid()) { if (context.IsValid()) {
std::set<std::string>& exclude_account_ids = context.hum->GetExcludeAccountIds(); std::set<std::string>& exclude_account_ids = context.hum->GetExcludeAccountIds();
std::set<std::string> batch_account_ids; std::set<std::string> batch_account_ids;
int my_gameid = f8::ExtractGameIdFromAccountId
(context.account_id);
int my_channel = f8::ExtractChannelIdFromAccountId
(context.account_id);
cs::SMRecommandFriend msg; cs::SMRecommandFriend msg;
for (auto& pair : recommand_friends) { for (auto& pair : recommand_friends) {
if (msg.friend_list_size() < 4) { if (msg.friend_list_size() < 4) {
auto p = msg.add_friend_list() ; auto p = msg.add_friend_list() ;
*p = pair.second; *p = pair.second;
{ {
int channel = f8::ExtractChannelIdFromAccountId
(context.account_id);
int target_channel = f8::ExtractChannelIdFromAccountId int target_channel = f8::ExtractChannelIdFromAccountId
(p->base_data().account_id()); (p->base_data().account_id());
App::Instance()->PreProcAvatarUrl App::Instance()->PreProcAvatarUrl
(channel, (my_channel,
target_channel, target_channel,
*p->mutable_base_data()->mutable_avatar_url()); *p->mutable_base_data()->mutable_avatar_url());
} }
@ -89,15 +93,19 @@ struct RecommandFriendTask
} }
if (exclude_account_ids.find(user_info->base_data().account_id()) == if (exclude_account_ids.find(user_info->base_data().account_id()) ==
exclude_account_ids.end()) { exclude_account_ids.end()) {
int target_gameid = f8::ExtractGameIdFromAccountId
(user_info->base_data().account_id());
int target_channel = f8::ExtractChannelIdFromAccountId
(user_info->base_data().account_id());
if (target_gameid != my_gameid || target_channel != my_channel) {
continue;
}
auto p = msg.add_friend_list(); auto p = msg.add_friend_list();
*p = *user_info; *p = *user_info;
{ {
int channel = f8::ExtractChannelIdFromAccountId
(context.account_id);
int target_channel = f8::ExtractChannelIdFromAccountId
(p->base_data().account_id());
App::Instance()->PreProcAvatarUrl App::Instance()->PreProcAvatarUrl
(channel, (my_channel,
target_channel, target_channel,
*p->mutable_base_data()->mutable_avatar_url()); *p->mutable_base_data()->mutable_avatar_url());
} }