public function onSearchGetThreads($tIds) { $authors = $authorids = array(); $result = Cloud_Service_SearchHelper::getThreads($tIds); if ($result) { $vtIds = $gfIds = array(); foreach ($result as $key => $thread) { $authors[$thread['authorId']][] = $thread['tId']; if ($thread['specialType'] == 'poll') { $vtIds[] = $thread['tId']; } if ($thread['isGroup']) { $gfIds[$thread['fId']] = $thread['fId']; } } $guestPerm = Cloud_Service_SearchHelper::getGuestPerm($gfIds); foreach ($result as $key => $row) { if (in_array($row['fId'], $guestPerm['allowForumIds'])) { $result[$key]['isPublic'] = true; } else { $result[$key]['isPublic'] = false; } } } if ($vtIds) { // vote $polls = Cloud_Service_SearchHelper::getPollInfo($vtIds); foreach ($polls as $tId => $poll) { $result[$tId]['pollInfo'] = $poll; } } $authorids = array_keys($authors); if ($authorids) { $banuids = $uids = array(); foreach (C::t('common_member')->fetch_all($authorids) as $uid => $author) { $uids[$uid] = $uid; if ($author['groupid'] == 4 || $author['groupid'] == 5) { $banuids[] = $author['uid']; } } $deluids = array_diff($authorids, $uids); foreach ($deluids as $deluid) { if (!$deluid) { continue; } foreach ($authors[$deluid] as $tid) { $result[$tid]['authorStatus'] = 'delete'; } } foreach ($banuids as $banuid) { foreach ($authors[$banuid] as $tid) { $result[$tid]['authorStatus'] = 'ban'; } } } return $result; }
function getReplyAndView($tids) { if (!$tids) { return array(); } $res = array(); $threads = Cloud_Service_SearchHelper::getThreads($tids); foreach ($threads as $thread) { $res[$thread['tId']] = array('tid' => $thread['tId'], 'replies' => $thread['replyNum'], 'views' => $thread['viewNum']); } return $res; }