private function _getUserInfos($uid, $longitude, $latitude, $radius, $page, $pageSize) { $userInfos = array('count' => 0, 'list' => array()); $count = SurroundingInfo::getUserCountByUid($uid, $longitude, $latitude, $radius); $surroundUsers = SurroundingInfo::getAllUsersByUid($uid, $longitude, $latitude, $radius, $page, $pageSize); $list = array(); foreach ($surroundUsers as $user) { $userInfo = array(); $tmpUid = (int) $user['object_id']; $userInfo['uid'] = $tmpUid; $userInfo['distance'] = $user['distance']; $userInfo['location'] = $user['location']; $userInfo['nickname'] = UserUtils::getUserName($tmpUid); $userInfo['gender'] = UserUtils::getUserGender($tmpUid); $userInfo['status'] = UserUtils::getUserLoginStatus($tmpUid) == UserUtils::STATUS_ONLINE ? 1 : 0; $userInfo['icon'] = UserUtils::getUserAvatar($tmpUid); // $userInfo['is_friend'] = UserUtils::isFriend($uid, $tmpUid) ? 1 : 0; $userInfo['is_friend'] = UserUtils::isFollow($uid, $tmpUid) ? 1 : 0; $userInfo['is_black'] = UserUtils::isBlacklist($uid, $tmpUid) ? 1 : 0; $list[] = $userInfo; } $userInfos['count'] = $count; $userInfos['list'] = $list; return $userInfos; }
private function _getUserInfo($res, $uid, $puid) { loadcache('usergroups'); $space = UserUtils::getUserInfo($puid); if (empty($space)) { return WebUtils::makeErrorInfo_oldVersion($res, 'space_does_not_exist'); } $spacePro = UserUtils::getUserProfile($puid); $spaceCount = DzUserInfo::getCommonMemberCount($puid); $space = array_merge($space, $spacePro, $spaceCount); $listCount = (int) DzUserInfo::getUserPhotosHomeAlbumCount($puid); $res['flag'] = $uid == $puid ? 1 : 0; $res['is_black'] = (int) UserUtils::isBlacklist($uid, $puid) ? 1 : 0; $res['is_follow'] = (int) UserUtils::isFollow($uid, $puid); $res['isFriend'] = (int) UserUtils::isFriend($uid, $puid) ? 1 : 0; $res['icon'] = UserUtils::getUserAvatar($puid, $spacePro); $res['level_url'] = ''; $res['name'] = $space['username']; $res['email'] = $space['email']; $res['status'] = (int) UserUtils::getUserLoginStatus($puid); $res['gender'] = (int) UserUtils::getUserGender($puid, $spacePro); $res['email'] = $space['email']; $res['score'] = (int) $space['credits']; $res['credits'] = (int) $space['credits']; $res['gold_num'] = (int) $space['extcredits2']; $res['topic_num'] = (int) $this->_getHomeTopicNum($puid); $res['photo_num'] = (int) $listCount['nums']; $res['reply_posts_num'] = (int) DzUserInfo::getTopicsByUidWithPostCount($puid); $res['essence_num'] = (int) $space['digestposts']; $res['friend_num'] = (int) DzUserInfo::getFollowFriendsCount($puid); $res['follow_num'] = (int) DzUserInfo::getFollowedFriendsCount($puid); $res['level'] = (int) DzCommonUserList::getUserLevel($space['groupid']); $res['userTitle'] = UserUtils::getUserTitle($puid, $space); $repeatList = array(); foreach (UserUtils::getRepeatList($uid) as $user) { $repeatList[] = array('userName' => $user); } $res['body']['repeatList'] = $repeatList; $res['body']['profileList'] = $this->_getPersonalDataInfo($puid, $space); $res['body']['creditList'] = $this->_getStatisticalInformation($uid, $space); $res['body']['creditShowList'] = $this->_getStatisticalInforSet($uid, $space); return $res; }
private function _transUserList($users, $viewUid, $longitude, $latitude, $radius, $page, $pageSize, $sortType) { loadcache('usergroups'); $list = array(); foreach ($users as $user) { if ($sortType == 'range') { $tmpUserInfo['distance'] = (string) $user['distance']; $tmpUserInfo['location'] = (string) WebUtils::t($user['location']); $uid = $user['uid']; } else { $tmpUserInfo['distance'] = ''; $tmpUserInfo['location'] = ''; $uid = $user; } $tmpUserInfo['is_friend'] = UserUtils::isFollow($viewUid, $uid) ? 1 : 0; $tmpUserInfo['isFriend'] = UserUtils::isFriend($viewUid, $uid) ? 1 : 0; $tmpUserInfo['isFollow'] = UserUtils::isFollow($viewUid, $uid) ? 1 : 0; $tmpUserInfo['uid'] = (int) $uid; $tmpUserInfo['name'] = UserUtils::getUserName($uid); $tmpUserInfo['name'] = WebUtils::emptyHtml($tmpUserInfo['name']); $tmpUserInfo['status'] = (int) UserUtils::getUserLoginStatus($uid); $tmpUserInfo['is_black'] = UserUtils::isBlacklist($viewUid, $uid) ? 1 : 0; $tmpUserInfo['gender'] = (int) UserUtils::getUserGender($uid); $tmpUserInfo['icon'] = UserUtils::getUserAvatar($uid); $tmpUserInfo['level'] = (int) DzCommonUserList::getUserLevel($uid); $lastLogin = WebUtils::t(DzCommonUserList::getUserLastVisit($uid)); $tmpUserInfo['lastLogin'] = $lastLogin . '000'; if ($sortType == 'regdate') { $lastRegdate = DzCommonUserList::getUserLastRegdate($uid); $tmpUserInfo['dateline'] = $lastRegdate . '000'; } else { $tmpUserInfo['dateline'] = $lastLogin . '000'; } $signature = WebUtils::emptyHtml(DzCommonUserList::getUserSightml($uid)); $tmpUserInfo['signature'] = WebUtils::t($signature); $userInfo = UserUtils::getUserInfo($uid); $tmpUserInfo['credits'] = (int) $userInfo['credits']; $list[] = $tmpUserInfo; } return $list; }
/** * 列表显示需要的字段 * * @param array $list 帖子或者文章的详细字段信息. * @param array $summary 帖子或者文章的摘要和图片. * @param string $source_type 源的类型. * @param int $source_id 源的id. * * @return array 整理好的字段. */ private function _getListField($list, $summary, $source_type, $source_id, $params = array()) { $row = array(); // 显示样式 if ($params['topic_style'] == 2) { $statu = 'lastpost'; } else { $statu = 'dateline'; } if ($source_type == 'topic') { $row['fid'] = (int) $list['fid']; } $row['source_type'] = (string) $source_type; $row['source_id'] = (int) $source_id; $row['title'] = $source_type == 'topic' ? (string) $list['subject'] : (string) $list['title']; $row['title'] = WebUtils::emptyHtml($row['title']); $row['user_id'] = $source_type == 'topic' ? (int) $list['authorid'] : (int) $list['uid']; $row['last_reply_date'] = $source_type == 'topic' ? $list[$statu] . '000' : $list['dateline'] . '000'; $row['user_nick_name'] = $source_type == 'topic' ? (string) $list['author'] : (string) $list['username']; $row['hits'] = $source_type == 'topic' ? (int) $list['views'] : (int) $list['viewnum']; $row['summary'] = (string) $summary['msg']; $row['replies'] = $source_type == 'topic' ? (int) $list['replies'] : (int) $list['commentnum']; $tempRow = ImageUtils::getThumbImageEx($summary['image'], 15, true, true); $row['pic_path'] = (string) $tempRow['image']; $row['ratio'] = $tempRow['ratio']; $row['redirectUrl'] = (string) $list['url']; $row['userAvatar'] = (string) UserUtils::getUserAvatar($row['user_id']); $row['gender'] = (int) UserUtils::getUserGender($row['user_id']); $row['recommendAdd'] = $source_type == 'topic' ? (int) ForumUtils::getRecommendAdd($row['source_id']) : 0; $row['isHasRecommendAdd'] = $source_type == 'topic' ? (int) ForumUtils::isHasRecommendAdd($row['source_id']) : 0; $row['distance'] = isset($list['distance']) ? (string) $list['distance'] : ''; $row['location'] = isset($list['location']) ? (string) $list['location'] : ''; $row['imageList'] = (array) $summary['imageList']; $row['sourceWebUrl'] = (string) ForumUtils::getSourceWebUrl($source_id, $source_type); return $row; }
private function _getListField($topicList) { global $_G; $forum = $_G['forum']; $isImageList = isset($_GET['isImageList']) ? $_GET['isImageList'] : 0; $list = array(); foreach ($topicList as $topic) { // 该主题是由别的版块移动过来的 $isTopicMoved = false; $movedTitle = ''; if ($topic['closed'] > 1) { $movedTitle = WebUtils::t('移动: '); $isTopicMoved = true; $topic['tid'] = $topic['closed']; } $tid = (int) $topic['tid']; $topicFid = (int) $topic['fid']; // 主题分类标题 $typeTitle = ''; if (WebUtils::getDzPluginAppbymeAppConfig('forum_allow_topictype_prefix')) { if (isset($forum['threadtypes']['prefix']) && $forum['threadtypes']['prefix'] == 1 && isset($forum['threadtypes']['types'][$topic['typeid']])) { $typeTitle = '[' . $forum['threadtypes']['types'][$topic['typeid']] . ']'; } } // 分类信息标题 $sortTitle = ''; if (WebUtils::getDzPluginAppbymeAppConfig('forum_allow_topicsort_prefix')) { if (!empty($forum['threadsorts']['prefix']) && isset($forum['threadsorts']['types'][$topic['sortid']])) { $sortTitle = '[' . $forum['threadsorts']['types'][$topic['sortid']] . ']'; } } $isTopicMoved && ($typeTitle = $sortTitle = ''); $topicInfo['board_id'] = $topicFid; $topicInfo['board_name'] = $fid != 0 ? $forum['name'] : ForumUtils::getForumName($topicFid); $topicInfo['board_name'] = WebUtils::emptyHtml($topicInfo['board_name']); $topicInfo['topic_id'] = $tid; $topicInfo['type'] = ForumUtils::getTopicType($topic); $topicInfo['title'] = $movedTitle . $typeTitle . $sortTitle . $topic['subject']; $topicInfo['title'] = WebUtils::emptyHtml($topicInfo['title']); // 修正帖子查看数 if (isset($_G['forum_thread']['views']) && $_G['forum_thread']['tid'] == $topic['tid'] && $_G['forum_thread']['views'] > $topic['views']) { $topic['views'] = $_G['forum_thread']['views']; } $topicInfo['user_id'] = (int) $topic['authorid']; $topicInfo['user_nick_name'] = $topic['author']; $topicInfo['last_reply_date'] = $topic['lastpost'] . '000'; $topicInfo['vote'] = ForumUtils::isVoteTopic($topic) ? 1 : 0; $topicInfo['hot'] = ForumUtils::isHotTopic($topic) ? 1 : 0; $topicInfo['hits'] = (int) $topic['views']; $topicInfo['replies'] = (int) $topic['replies']; $topicInfo['essence'] = ForumUtils::isMarrowTopic($topic) ? 1 : 0; $topicInfo['top'] = ForumUtils::isTopTopic($topic) ? 1 : 0; $topicInfo['status'] = (int) $topic['status']; $cache = Yii::app()->params['mobcent']['cache']['topicSummary']; $key = sprintf('mobcentTopicSummary_%s_%s_%s', $tid, $_G['groupid'], $isImageList); if (!$cache['enable'] || ($topicSummary = Yii::app()->cache->get($key)) === false) { $topicSummary = ForumUtils::getTopicSummary($tid, 'forum', true, array('imageList' => $isImageList, 'imageListLen' => 9, 'imageListThumb' => 1)); if ($cache['enable']) { Yii::app()->cache->set($key, $topicSummary, $cache['expire']); } } $topicInfo['subject'] = $topicSummary['msg']; // $topicInfo['pic_path'] = ImageUtils::getThumbImage($topicSummary['image']); $tempTopicInfo = ImageUtils::getThumbImageEx($topicSummary['image'], 15, true, false); $topicInfo['pic_path'] = $tempTopicInfo['image']; $topicInfo['ratio'] = $tempTopicInfo['ratio']; $topicInfo['userAvatar'] = UserUtils::getUserAvatar($topic['authorid']); $topicInfo['gender'] = (int) UserUtils::getUserGender($topic['authorid']); $topicInfo['recommendAdd'] = (int) ForumUtils::getRecommendAdd($tid); $topicInfo['isHasRecommendAdd'] = ForumUtils::isHasRecommendAdd($tid); $topicInfo['imageList'] = (array) $topicSummary['imageList']; $topicInfo['sourceWebUrl'] = (string) ForumUtils::getSourceWebUrl($tid, 'topic'); $tmpList = $list[] = $topicInfo; } return $list; }