添加头像预处理
This commit is contained in:
parent
0a4b2392e1
commit
1b4a4f44a8
@ -675,3 +675,10 @@ bool App::IsTimeToReset(int time)
|
|||||||
{
|
{
|
||||||
return BetweenDays(nowtime - 60 * SYS_RESET_TIME, time - 60 * SYS_RESET_TIME) > 0;
|
return BetweenDays(nowtime - 60 * SYS_RESET_TIME, time - 60 * SYS_RESET_TIME) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void App::PreProcAvatarUrl(int self_channel, int target_channel, std::string& target_avatar_url)
|
||||||
|
{
|
||||||
|
if (self_channel == 6001 && target_channel != 6001) {
|
||||||
|
target_avatar_url = "https://wx.qlogo.cn/mmopen/vi_32/q4oRsMFYBwPEVAeVI7tiasWSqaibr0GPQia432JhibGRYhqqEJofpWDYxJPq6q0hQ0j7icdACdHL78hrjYYHSjZQ3YA/132";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -36,6 +36,7 @@ class App : public a8::Singleton<App>
|
|||||||
long long NewSeqId();
|
long long NewSeqId();
|
||||||
time_t BetweenDays(time_t time1, time_t time2);
|
time_t BetweenDays(time_t time1, time_t time2);
|
||||||
bool IsTimeToReset(int time);
|
bool IsTimeToReset(int time);
|
||||||
|
void PreProcAvatarUrl(int self_channel, int target_channel, std::string& target_avatar_url);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void QuickExecute();
|
void QuickExecute();
|
||||||
|
@ -62,7 +62,18 @@ struct RecommandFriendTask
|
|||||||
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) {
|
||||||
*msg.add_friend_list() = pair.second;
|
auto p = msg.add_friend_list() ;
|
||||||
|
*p = pair.second;
|
||||||
|
{
|
||||||
|
int channel = f8::ExtractChannelIdFromAccountId
|
||||||
|
(context.account_id);
|
||||||
|
int target_channel = f8::ExtractChannelIdFromAccountId
|
||||||
|
(p->base_data().account_id());
|
||||||
|
App::Instance()->PreProcAvatarUrl
|
||||||
|
(channel,
|
||||||
|
target_channel,
|
||||||
|
*p->mutable_base_data()->mutable_account_id());
|
||||||
|
}
|
||||||
exclude_account_ids.insert(pair.first);
|
exclude_account_ids.insert(pair.first);
|
||||||
batch_account_ids.insert(pair.first);
|
batch_account_ids.insert(pair.first);
|
||||||
}
|
}
|
||||||
@ -76,7 +87,18 @@ 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()) {
|
||||||
*msg.add_friend_list() = *user_info;
|
auto p = msg.add_friend_list();
|
||||||
|
*p = *user_info;
|
||||||
|
{
|
||||||
|
int channel = f8::ExtractChannelIdFromAccountId
|
||||||
|
(context.account_id);
|
||||||
|
int target_channel = f8::ExtractChannelIdFromAccountId
|
||||||
|
(p->base_data().account_id());
|
||||||
|
App::Instance()->PreProcAvatarUrl
|
||||||
|
(channel,
|
||||||
|
target_channel,
|
||||||
|
*p->mutable_base_data()->mutable_account_id());
|
||||||
|
}
|
||||||
exclude_account_ids.insert(user_info->base_data().account_id());
|
exclude_account_ids.insert(user_info->base_data().account_id());
|
||||||
batch_account_ids.insert(user_info->base_data().account_id());
|
batch_account_ids.insert(user_info->base_data().account_id());
|
||||||
}
|
}
|
||||||
|
@ -398,6 +398,14 @@ void Player::_CMFriendAddBlack(f8::MsgHdr& hdr, const cs::CMFriendAddBlack& msg)
|
|||||||
auto user_info = notifymsg.add_user_infos();
|
auto user_info = notifymsg.add_user_infos();
|
||||||
TypeConvert::Convert(p->base_data, *user_info->mutable_base_data());
|
TypeConvert::Convert(p->base_data, *user_info->mutable_base_data());
|
||||||
TypeConvert::Convert(p->temp_custom_data, *user_info->mutable_temp_custom_data());
|
TypeConvert::Convert(p->temp_custom_data, *user_info->mutable_temp_custom_data());
|
||||||
|
{
|
||||||
|
int target_channel = f8::ExtractChannelIdFromAccountId
|
||||||
|
(user_info->base_data().account_id());
|
||||||
|
App::Instance()->PreProcAvatarUrl
|
||||||
|
(channel,
|
||||||
|
target_channel,
|
||||||
|
*user_info->mutable_base_data()->mutable_account_id());
|
||||||
|
}
|
||||||
SendMsg(notifymsg);
|
SendMsg(notifymsg);
|
||||||
}
|
}
|
||||||
black_hash_[p->base_data.account_id] = p;
|
black_hash_[p->base_data.account_id] = p;
|
||||||
@ -419,6 +427,14 @@ void Player::_CMFriendAddBlack(f8::MsgHdr& hdr, const cs::CMFriendAddBlack& msg)
|
|||||||
auto user_info = notifymsg.add_user_infos();
|
auto user_info = notifymsg.add_user_infos();
|
||||||
TypeConvert::Convert(p->base_data, *user_info->mutable_base_data());
|
TypeConvert::Convert(p->base_data, *user_info->mutable_base_data());
|
||||||
TypeConvert::Convert(p->temp_custom_data, *user_info->mutable_temp_custom_data());
|
TypeConvert::Convert(p->temp_custom_data, *user_info->mutable_temp_custom_data());
|
||||||
|
{
|
||||||
|
int target_channel = f8::ExtractChannelIdFromAccountId
|
||||||
|
(user_info->base_data().account_id());
|
||||||
|
App::Instance()->PreProcAvatarUrl
|
||||||
|
(channel,
|
||||||
|
target_channel,
|
||||||
|
*user_info->mutable_base_data()->mutable_account_id());
|
||||||
|
}
|
||||||
SendMsg(notifymsg);
|
SendMsg(notifymsg);
|
||||||
}
|
}
|
||||||
MarkDirty();
|
MarkDirty();
|
||||||
@ -741,6 +757,14 @@ void Player::FillBlackList(::google::protobuf::RepeatedPtrField< ::cs::MFUserInf
|
|||||||
auto p = black_list->Add();
|
auto p = black_list->Add();
|
||||||
TypeConvert::Convert(pair.second->base_data, *(p->mutable_base_data()));
|
TypeConvert::Convert(pair.second->base_data, *(p->mutable_base_data()));
|
||||||
TypeConvert::Convert(pair.second->temp_custom_data, *(p->mutable_temp_custom_data()));
|
TypeConvert::Convert(pair.second->temp_custom_data, *(p->mutable_temp_custom_data()));
|
||||||
|
{
|
||||||
|
int target_channel = f8::ExtractChannelIdFromAccountId
|
||||||
|
(p->base_data().account_id());
|
||||||
|
App::Instance()->PreProcAvatarUrl
|
||||||
|
(channel,
|
||||||
|
target_channel,
|
||||||
|
*p->mutable_base_data()->mutable_account_id());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -764,6 +788,13 @@ void Player::FillMFUserInfo(cs::MFUserInfo* user_info)
|
|||||||
{
|
{
|
||||||
TypeConvert::Convert(myself.base_data, *(user_info->mutable_base_data()));
|
TypeConvert::Convert(myself.base_data, *(user_info->mutable_base_data()));
|
||||||
TypeConvert::Convert(myself.temp_custom_data, *(user_info->mutable_temp_custom_data()));
|
TypeConvert::Convert(myself.temp_custom_data, *(user_info->mutable_temp_custom_data()));
|
||||||
|
{
|
||||||
|
int target_channel = f8::ExtractChannelIdFromAccountId(user_info->base_data().account_id());
|
||||||
|
App::Instance()->PreProcAvatarUrl
|
||||||
|
(channel,
|
||||||
|
target_channel,
|
||||||
|
*user_info->mutable_base_data()->mutable_account_id());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::set<std::string>& Player::GetExcludeAccountIds()
|
std::set<std::string>& Player::GetExcludeAccountIds()
|
||||||
@ -863,7 +894,16 @@ void Player::FillApplyList(const cs::MFPaging& paging, cs::SMFriendApplyList& re
|
|||||||
if (GetBlackListById(pair.second->base_data.account_id)) {
|
if (GetBlackListById(pair.second->base_data.account_id)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
TypeConvert::Convert(*pair.second, *respmsg.add_apply_list());
|
cs::MFFriendApply* apply_pb = respmsg.add_apply_list();
|
||||||
|
TypeConvert::Convert(*pair.second, *apply_pb);
|
||||||
|
{
|
||||||
|
int target_channel = f8::ExtractChannelIdFromAccountId
|
||||||
|
(apply_pb->base_data().account_id());
|
||||||
|
App::Instance()->PreProcAvatarUrl
|
||||||
|
(channel,
|
||||||
|
target_channel,
|
||||||
|
*apply_pb->mutable_base_data()->mutable_account_id());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
@ -1062,6 +1102,14 @@ void Player::NotifyUserInfoUpdate(Friend* friend_data)
|
|||||||
auto p = msg.add_user_infos();
|
auto p = msg.add_user_infos();
|
||||||
TypeConvert::Convert(friend_data->base_data, *p->mutable_base_data());
|
TypeConvert::Convert(friend_data->base_data, *p->mutable_base_data());
|
||||||
TypeConvert::Convert(friend_data->temp_custom_data, *p->mutable_temp_custom_data());
|
TypeConvert::Convert(friend_data->temp_custom_data, *p->mutable_temp_custom_data());
|
||||||
|
{
|
||||||
|
int target_channel = f8::ExtractChannelIdFromAccountId
|
||||||
|
(p->base_data().account_id());
|
||||||
|
App::Instance()->PreProcAvatarUrl
|
||||||
|
(channel,
|
||||||
|
target_channel,
|
||||||
|
*p->mutable_base_data()->mutable_account_id());
|
||||||
|
}
|
||||||
SendMsg(msg);
|
SendMsg(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1086,6 +1134,14 @@ void Player::SyncOtherFriend()
|
|||||||
auto p = msg.add_user_infos();
|
auto p = msg.add_user_infos();
|
||||||
TypeConvert::Convert(myself.base_data, *p->mutable_base_data());
|
TypeConvert::Convert(myself.base_data, *p->mutable_base_data());
|
||||||
TypeConvert::Convert(myself.temp_custom_data, *p->mutable_temp_custom_data());
|
TypeConvert::Convert(myself.temp_custom_data, *p->mutable_temp_custom_data());
|
||||||
|
{
|
||||||
|
int target_channel = f8::ExtractChannelIdFromAccountId
|
||||||
|
(p->base_data().account_id());
|
||||||
|
App::Instance()->PreProcAvatarUrl
|
||||||
|
(channel,
|
||||||
|
target_channel,
|
||||||
|
*p->mutable_base_data()->mutable_account_id());
|
||||||
|
}
|
||||||
|
|
||||||
for (auto& pair : friend_hash_) {
|
for (auto& pair : friend_hash_) {
|
||||||
Player* hum = PlayerMgr::Instance()->GetPlayerByAccountId(pair.second->base_data.account_id);
|
Player* hum = PlayerMgr::Instance()->GetPlayerByAccountId(pair.second->base_data.account_id);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user