Int2IntSeqMap FeedGroupManagerI::GetMembers(const ::MyUtil::IntSeq& gids, const ::Ice::Current&) { Int2IntSeqMap res; for (unsigned i = 0; i != gids.size(); ++i) { res[gids.at(i)] = UnreadInfoPool::instance().GetMembersInGroup(gids.at(i)); } MCE_INFO("FeedGroupManagerI::GetMembers gids size:" << gids.size() << " res size:" << res.size() ); return res; }
void OnlineManagerI::setStats(const ::MyUtil::IntSeq& userIds, ::Ice::Int onlineType, bool online, const Ice::Current& current) { MCE_DEBUG("OnlineManagerI::setStats working..."); for (size_t i = 0; i< userIds.size() ; ++i) { setStat(userIds.at(i) , onlineType, online); } }
void StatManagerI::login(const MyUtil::IntSeq& ids, const Ice::Current&) { MCE_DEBUG("StatManagerI::login --> ids.size:" << ids.size()); for (size_t i = 0; i < ids.size(); ++i) { bool succ = addLoginUser(ids.at(i)); /*if (succ) { addNotifyId(ids.at(i)); //addNotifyId(128487631); }*/ StatPtr st = new Stat; st->loginCount = 1; setStat(ids.at(i), st); // if(ids.at(i) == 200865373){ // RestMediatorAdapter::instance().useImNotify(ids.at(i)); // } } }
MyUtil::Int2IntMap SocialGraphBuddyByIdAdapter::getFriendCounts(const MyUtil::IntSeq& hostIds) { if(hostIds.empty()) { return MyUtil::Int2IntMap(); } else { try { return getProxy(hostIds.at(0))->getFriendCounts(hostIds); } catch(...) { return MyUtil::Int2IntMap(); } } }
bool BuddyList::load() { IceUtil::Mutex::Lock lock(_mutex); StatFunc statF("BuddyList::load --> ***"); MCE_DEBUG("BuddyList::load --> load online buddies " << _userId); MyUtil::IntSeq ids; try { MCE_DEBUG("BuddyList::load --> invoke BuddyCore " << _userId); ids = BuddyByIdCacheAdapter::instance().getFriendListAsc(_userId, 5000); MCE_DEBUG("BuddyList::load --> buddies count " << ids.size()); } catch (Ice::Exception& e) { MCE_WARN("BuddyList::load -> get buddies error" << e); return false; } for(size_t i=0; i<ids.size(); i++){ if(OnlineManagerI::instance().has(ids.at(i))){ _buddies.insert(ids.at(i)); } } MCE_DEBUG("BuddyList::load --> online buddies count " << _buddies.size()); return true; }
//-------------------------------------------------------------------------------- void VertifyPipe::handle(const ObjectSeq& seq) { //MCE_INFO("VertifyPipe::handle --> thread_id = " << pthread_self()); if (seq.empty()) { return; } else { //MCE_DEBUG("VertifyPipe::handle --> objectseq size = " <<seq.size()); } VerifySeq vSeq; IntSeq needNotVerifyUsers; for (size_t i = 0; i < seq.size(); ++i) { MessagePtr m = MessagePtr::dynamicCast(seq.at(i)); //MCE_INFO("m->from = " << m->from->userId << " m->to = " << m->to->userId); if( (m->type != MESSAGE && m->type != OFFLINE_MESSAGE) || (m->from->userId == 365734329 || m->to->userId == 365734329) ){//客服ID,不检查好友。 //MCE_INFO("VertifyPipe::handle --> m->from = " << m->from << " m->to = " << m->to); needNotVerifyUsers.push_back(i); continue; } VerifyPtr v = new Verify(); v->from = m->from->userId; v->to = m->to->userId; /*if(MESSAGE != m->type){ v->to = v->from; }*/ v->type = m->type; /* if (v->type == SYSTEM_MESSAGE) { v->sysMsgType = m->from->endpoint; }*/ v->index = i; vSeq.push_back(v); } MyUtil::IntSeq indexSeq; try{ indexSeq = TalkRightAdapter::instance().batchVerify(getIndex(), vSeq); }catch(Ice::Exception& e){ MCE_WARN("VertifyPipe::handle-->TalkRightAdapter::batchVerify-->" << e); } indexSeq.insert(indexSeq.end(), needNotVerifyUsers.begin(), needNotVerifyUsers.end()); //MCE_DEBUG("VertifyPipe::handle -->indexSeq size:"<<indexSeq.size()); for (size_t i = 0; i < indexSeq.size(); ++i) { MessagePtr m = MessagePtr::dynamicCast(seq.at(indexSeq.at(i))); //MCE_DEBUG("VertifyPipe::handle --> "<<m->to->index); if (m->to->index == 0 || m->to->index == 2 || m->to->index >1) { //MCE_DEBUG("VertifyPipe::handle --> endpoint:"<<m->to->endpoint); PipePool::instance().push(m->to->endpoint, 0, m); } } }
map<string, string> UseImNotifyTask::parameters(){ map<string, string> paras; paras["method"] = "notifications.send"; paras["session_key"] = boost::lexical_cast<string>(_userid); //paras["api_key"] = "ffa4add0b30141aa9eb9a8f1af34a8c3"; //paras["call_id"] = boost::lexical_cast<string>(time(NULL)); //paras["v"] = "1.0"; //paras["format"] = "xml"; MyUtil::IntSeq ids; try{ ids = BuddyByOnlineTimeCacheAdapter::instance().getFriendList(_userid, 20); } catch(Ice::Exception& e){ MCE_WARN("UseImNotifyTask::parameters-->BuddyByOnlineTimeCacheAdapter::getFriendList-->" << e); } if(ids.empty()) { return map<string, string>(); } MCE_INFO("UseImNotifyTask::parameters --> " << _userid << " " << ids.size()); ostringstream buddyids; for(size_t i = 0; i < ids.size(); ++i) { // int c = ids.size() < 10? ids.size(): 10; // for(size_t i = 0; i < c; ++i) { if(i) { buddyids << ","; } buddyids << ids.at(i); } paras["to_ids"] = buddyids.str(); ostringstream msg[3]; msg[0] << "<xn:name uid=\""<<_userid<<"\" linked=\"true\"/>悄悄安装了<a href=\"http://im.renren.com/desktop.html?answer1\">人人桌面</a>,能定时启动游戏,采摘你的果实,升级更快了!| <a href=\"http://im.renren.com/desktop/ver19/rrsetup.exe?answer1\">赶紧安装不能落后!</a>"; msg[1] << "<xn:name uid=\""<<_userid<<"\" linked=\"true\"/>抢先体验了<a href=\"http://im.renren.com/desktop.html?settime2\">人人桌面</a>,留言提醒、快速回复、好友聊天更快更稳定! | <a href=\"http://im.renren.com/desktop/ver19/rrsetup.exe?settime2\">快来安装吧</a>"; msg[2] << "<xn:name uid=\""<<_userid<<"\" linked=\"true\"/>用<a href=\"http://im.renren.com/desktop.html?onemin3\">人人桌面</a>登录了人人网,TA不开网页,就能一键登录、隐身上线、定时玩游戏! | <a href=\"http://im.renren.com/desktop/ver19/rrsetup.exe?onemin3\">我也要安装</a>"; paras["notification"] = msg[abs(_userid)%3].str(); /* paras["sig"] = makeSig(paras); string path = "http://api.xiaonei.com/server/restserver.do"; try{ RestMediatorAdapter::instance().restRequest(id(), _userid, path, paras); }catch(Ice::Exception& e){ MCE_WARN("UseImNotifyTask::handle --> invoke RestMediatorAdapter error" << e); }*/ return paras; }
FeedItemSeqSeq FeedItemManagerI::GetFeedItemSeqSeqByUsers( const MyUtil::IntSeq& ids, const Ice::Current&) { MCE_DEBUG("FeedItemManagerI::GetFeedItemSeqSeqByUsers --> start. index = "<< ids.at(0) %20 << ",ids size = " <<ids.size() << ",ids = " << Con2Str(ids)); FeedItemSeqSeq itemseqseq; for (vector<int>::const_iterator vit = ids.begin(); vit != ids.end(); ++vit) { UserFeedSetPtr feedSet; try { feedSet = locateUserFeedSet(*vit); // if (!feedSet) { MCE_DEBUG("FeedItemManagerI::GetFeedItemSeqSeqByUsers --> fail to get UserFeedSetPtr of user = "******"FeedItemManagerI::GetFeedItemSeqSeqByUsers-->user = "******", exception :" <<e); } } MCE_DEBUG("FeedItemManagerI::GetFeedItemSeqSeqByUsers --> ids size = " <<ids.size() << ",ids = " << Con2Str(ids) << ",itemseqseq size = " << itemseqseq.size()); return itemseqseq; }
MyUtil::Int2IntSeqMap BuddyByAddTimeCacheAdapter::getFriendLists(const MyUtil::IntSeq& ids){ if (ids.empty()){ return MyUtil::Int2IntSeqMap(); } size_t numCluster_sizeT = getCluster(); int numCluster = (int)numCluster_sizeT; if (numCluster < 0) { MCE_WARN("[BuddyByAddTimeCacheAdapter::getFriendLists] this should not be seen! Why cluster=" << numCluster_sizeT << " ???" ); return MyUtil::Int2IntSeqMap(); } if (numCluster == 0 || numCluster == 1) { try { return getProxy(ids.at(0))->getFriendLists(ids); } catch (...) { return MyUtil::Int2IntSeqMap(); } } else { vector< vector<int> > seperatedIds; seperatedIds.resize( numCluster ); for( MyUtil::IntSeq::const_iterator it = ids.begin(); it != ids.end(); ++it ){ seperatedIds.at( *it % numCluster ).push_back( *it ); } MyUtil::Int2IntSeqMap result; for (int posCluster = 0; posCluster < numCluster; ++posCluster) { MyUtil::Int2IntSeqMap someResult; if( seperatedIds.at(posCluster).size() > 0 ){ try { someResult = getProxy(posCluster)->getFriendLists(seperatedIds.at(posCluster)); } catch (...) { MCE_WARN( "BuddyByAddTimeCacheAdapter::getFriendLists from Proxy(" << posCluster << ") handle unknown exception." ); } result.insert( someResult.begin(), someResult.end() ); } } return result; } }
void StatManagerI::wLogin(const MyUtil::IntSeq& ids, const Ice::Current&) { for (size_t i = 0; i < ids.size(); ++i) { addWloginUser(ids.at(i)); } }
AvatarMap OnlineCenterAdapter::getUsersAvatars(const MyUtil::IntSeq& ids, int onlineType) { if(ids.empty()){ return AvatarMap(); } return getManager(ids.at(0))->getUsersAvatars(ids, onlineType); }
UserOnlineTypeSeq OnlineCenterAdapter::getUsersOnlineTypeSeq(const MyUtil::IntSeq& ids, int timeout){ if(ids.empty()){ return UserOnlineTypeSeq(); } return getManager(ids.at(0), timeout)->getUsersOnlineTypeSeq(ids); }