/** * 我看过谁 */ public function tovisitAction() { $space = $this->_getSpaceDs()->getSpace($this->loginUser->uid); $visitors = $space['tovisitors'] ? unserialize($space['tovisitors']) : array(); $uids = array_keys($visitors); if ($uids) { $userList = Wekit::load('user.PwUser')->fetchUserByUid($uids, PwUser::FETCH_MAIN | PwUser::FETCH_DATA | PwUser::FETCH_INFO); $userList = $this->_buildData($userList, $uids); $follows = $this->_getAttentionDs()->fetchFollows($this->loginUser->uid, $uids); $fans = $this->_getAttentionDs()->fetchFans($this->loginUser->uid, $uids); $friends = array_intersect_key($fans, $follows); $this->setOutput($friends, 'friends'); $this->setOutput($userList, 'userList'); $this->setOutput($follows, 'follows'); $this->setOutput($fans, 'fans'); } else { Wind::import('SRV:user.vo.PwUserSo'); $vo = new PwUserSo(); $vo->orderbyLastpost(false); $lastPostUser = Wekit::load('SRV:user.PwUserSearch')->searchUser($vo, 2); if ($lastPostUser) { unset($lastPostUser[$this->loginUser->uid]); $lastPostUser = array_keys($lastPostUser); $this->setOutput($lastPostUser[0], 'lastPostUser'); } } $this->setOutput($visitors, 'visitors'); }
protected function getData($field, $order, $limit, $offset) { Wind::import('SRV:user.vo.PwUserSo'); $so = new PwUserSo(); $field['uids'] && $so->setUid($field['uids']); $field['gid'] != '-1' && $so->setGid($field['gid']); if ($field['gender']) { if (in_array(0, $field['gender']) && !in_array(1, $field['gender'])) { $so->setGender(0); } elseif (!in_array(0, $field['gender']) && in_array(1, $field['gender'])) { $so->setGender(1); } } $field['hometown']['id'] && $so->setHometown($field['hometown']['id']); $field['location']['id'] && $so->setLocation($field['location']['id']); $orderby = $field['orderby']; switch ($orderby) { case '2': //按主题数倒序, $so->orderbyPostnum(false); break; case '3': //按发帖时间倒序, $so->orderbyLastpost(false); break; case '4': //按被喜欢数倒序, break; case '5': //按注册时间倒序, $so->orderbyRegdate(false); break; case '6': // 按访问时间倒序, $so->orderbyLastvisit(false); break; case '1': //系统推荐排序 //系统推荐排序 default: break; } $list = Wekit::load('user.PwUserSearch')->searchUserAllData($so, $limit, $offset); return $this->_buildSignKey($list); }