コード例 #1
0
 public function run($ids)
 {
     $so = new PwThreadSo();
     $so->setFid($this->srv->fid);
     $data = Wekit::load('forum.PwThread')->searchThread($so, 0);
     $tids = array_keys($data);
     $dm = new PwTopicDm();
     $dm->setFid($this->srv->tofid);
     Wekit::load('forum.PwThread')->batchUpdateThread($tids, $dm, PwThread::FETCH_MAIN);
     $dm = new PwReplyDm();
     $dm->setFid($this->srv->tofid);
     Wekit::load('forum.PwThread')->batchUpdatePostByTid($tids, $dm);
 }
コード例 #2
0
ファイル: IndexController.php プロジェクト: sanzhumu/nextwind
 public function run()
 {
     if (($result = $this->_checkRight()) instanceof PwError) {
         $this->showError($result->getError());
     }
     list($page, $perpage, $keywords, $fid, $limittime, $orderby) = $this->getInput(array('page', 'perpage', 'keywords', 'fid', 'limittime', 'orderby'));
     if ($keywords) {
         //最后搜索时间
         if (($result = $this->_checkSearch()) instanceof PwError) {
             $this->showError($result->getError());
         }
         $page = $page ? $page : 1;
         $perpage = $perpage ? $perpage : $this->perpage;
         list($start, $limit) = Pw::page2limit($page, $perpage);
         !$orderby && ($orderby = 'lastpost_time');
         Wind::import('SRV:forum.vo.PwThreadSo');
         $so = new PwThreadSo();
         $keywords = urldecode($keywords);
         $so->setKeywordOfTitleOrContent($keywords);
         $fid && $so->setFid($fid);
         $limittime && $so->setCreateTimeStart($this->_getLimitTime($limittime));
         $so = $this->_getOrderBy($so, $orderby);
         $count = $this->_getSearchService()->countSearchThread($so);
         $count = $count > $this->maxNum ? $this->maxNum : $count;
         if ($count) {
             $threads = $this->_getSearchService()->searchThread($so, $limit, $start);
             $threads = $this->_getSearchService()->buildThreads($threads, $keywords);
             $this->_replaceRecord($keywords, App_Search_Record::TYPE_THREAD);
         }
         $this->setOutput($page, 'page');
         $this->setOutput($perpage, 'perpage');
         $this->setOutput($count, 'count');
         $this->setOutput($threads, 'threads');
         $this->setOutput(array(1 => 'img', 3 => 'img', 4 => 'file', 5 => 'img', 7 => 'img'), 'uploadIcon');
         $this->setOutput(array('img' => '图片帖', 'file' => '附件'), 'icon');
     }
     $args = array('keywords' => $keywords, 'fid' => $fid, 'limittime' => $limittime, 'orderby' => $orderby);
     $this->setOutput($args, 'args');
     $forumList = Wekit::load('forum.srv.PwForumService')->getForumList();
     $this->setOutput(App_Search_Record::TYPE_THREAD, 'recordType');
     $this->setOutput($forumList, 'forumList');
     $this->setOutput($this->getCommonForumList($forumList), 'forumdb');
     $this->setTemplate('index_run');
     //seo设置
     $seoBo = PwSeoBo::getInstance();
     $seoBo->setCustomSeo($keywords . ' - {sitename}', '', '');
     Wekit::setV('seo', $seoBo);
 }
コード例 #3
0
 public function run()
 {
     $page = intval($this->getInput('page'));
     list($author, $fid, $createdTimeStart, $createdTimeEnd) = $this->getInput(array('author', 'fid', 'created_time_start', 'created_time_end'));
     $page < 1 && ($page = 1);
     $perpage = 20;
     list($start, $limit) = Pw::page2limit($page, $perpage);
     Wind::import('SRV:forum.vo.PwThreadSo');
     $so = new PwThreadSo();
     $so->setDisabled(1)->orderbyCreatedTime(0);
     if ($author) {
         $so->setAuthor($author);
     }
     if ($fid) {
         $forum = Wekit::load('forum.PwForum')->getForum($fid);
         if ($forum['type'] != 'category') {
             $so->setFid($fid);
         } else {
             $srv = Wekit::load('forum.srv.PwForumService');
             $fids = array(0);
             $forums = $srv->getForumsByLevel($fid, $srv->getForumMap());
             foreach ($forums as $value) {
                 $fids[] = $value['fid'];
             }
             $so->setFid($fids);
         }
     }
     if ($createdTimeStart) {
         $so->setCreateTimeStart(Pw::str2time($createdTimeStart));
     }
     if ($createdTimeEnd) {
         $so->setCreateTimeEnd(Pw::str2time($createdTimeEnd));
     }
     $count = Wekit::load('forum.PwThread')->countSearchThread($so);
     $threaddb = Wekit::load('forum.PwThread')->searchThread($so, $limit, $start, PwThread::FETCH_ALL);
     $this->setOutput($threaddb, 'threadb');
     $this->setOutput(Wekit::load('forum.srv.PwForumService')->getForumList($fid), 'forumlist');
     $this->setOutput(Wekit::load('forum.srv.PwForumService')->getForumOption($fid), 'option_html');
     $this->setOutput(array('author' => $author, 'created_time_start' => $createdTimeStart, 'created_time_end' => $createdTimeEnd, 'fid' => $fid), 'args');
     $this->setOutput($page, 'page');
     $this->setOutput($perpage, 'perpage');
     $this->setOutput($count, 'count');
 }
コード例 #4
0
 public function run()
 {
     $page = intval($this->getInput('page'));
     list($author, $fid, $createdTimeStart, $createdTimeEnd) = $this->getInput(array('author', 'fid', 'created_time_start', 'created_time_end'));
     $page < 1 && ($page = 1);
     $perpage = 20;
     list($start, $limit) = Pw::page2limit($page, $perpage);
     Wind::import('SRV:forum.vo.PwThreadSo');
     $so = new PwThreadSo();
     $so->setDisabled(1)->orderbyCreatedTime(0);
     $url = array();
     if ($author) {
         $so->setAuthor($author);
         $url['author'] = $author;
     }
     if ($fid) {
         $so->setFid($fid);
         $url['fid'] = $fid;
     }
     if ($createdTimeStart) {
         $so->setCreateTimeStart(Pw::str2time($createdTimeStart));
         $url['created_time_start'] = $createdTimeStart;
     }
     if ($createdTimeEnd) {
         $so->setCreateTimeEnd(Pw::str2time($createdTimeEnd));
         $url['created_time_end'] = $createdTimeEnd;
     }
     $count = Wekit::load('forum.PwThread')->countSearchThread($so);
     $threaddb = Wekit::load('forum.PwThread')->searchThread($so, $limit, $start);
     $this->setOutput($threaddb, 'threadb');
     $this->setOutput(Wekit::load('forum.srv.PwForumService')->getForumOption($fid), 'option_html');
     $this->setOutput($page, 'page');
     $this->setOutput($perpage, 'perpage');
     $this->setOutput($count, 'count');
     $this->setOutput($url, 'url');
     // seo设置
     Wind::import('SRV:seo.bo.PwSeoBo');
     $seoBo = PwSeoBo::getInstance();
     $lang = Wind::getComponent('i18n');
     $seoBo->setCustomSeo($lang->getMessage('SEO:manage.content.run.title'), '', '');
     Wekit::setV('seo', $seoBo);
 }
コード例 #5
0
 public function getLatestThreadsByFids($fids, $offset, $limit)
 {
     if (!ACloudSysCoreS::isArray($fids)) {
         return $this->buildResponse(0, array());
     }
     Wind::import('SRV:forum.vo.PwThreadSo');
     $uids = $result = array();
     $threaddb = array();
     $so = new PwThreadSo();
     $so->setFid($fids)->setDisabled(0)->orderbyCreatedTime(0);
     $threaddb = $this->_getThread()->searchThread($so, $limit, $offset);
     if (!$threaddb) {
         return $this->buildResponse(THREAD_NOT_EXIST, "帖子不存在");
     }
     $forums = $this->_getForum()->fetchForum($fids, PwForum::FETCH_MAIN);
     $result = array();
     foreach ($threaddb as $key => $value) {
         if (!$value) {
             continue;
         }
         $value['forumname'] = strip_tags($forums[$value]['name']);
         $value['icon'] = Pw::getAvatar($value['created_userid']);
         $uids[$value['tid']] = $value['created_userid'];
         $result['threads'][$value['tid']] = $value;
     }
     return $this->buildResponse(0, $result);
 }
コード例 #6
0
ファイル: PwThread.php プロジェクト: YoursBoss/nextwind
 /**
  * 搜索帖子
  *
  * @param object $so
  * @return array
  */
 public function searchThread(PwThreadSo $so, $limit = 20, $offset = 0, $fetchmode = self::FETCH_MAIN)
 {
     return $this->_getThreadMergeDao()->searchThread($fetchmode, $so->getData(), $so->getOrderby(), $limit, $offset);
 }
コード例 #7
0
 protected function getData($field, $order, $limit, $offset)
 {
     Wind::import('SRV:forum.vo.PwThreadSo');
     $so = new PwThreadSo();
     $time = Pw::getTime();
     $so->setDisabled(0);
     $field['tids'] && $so->setTid(explode(' ', $field['tids']));
     if ($field['usernames']) {
         $usernames = explode(' ', $field['usernames']);
         foreach ($usernames as &$username) {
             $username = trim($username);
         }
         $users = Wekit::load('user.PwUser')->fetchUserByName($usernames);
         $uids = array_keys($users);
         if ($uids) {
             $so->setAuthorId($uids);
         } else {
             return array();
         }
     }
     $field['keywords'] && $so->setKeywordOfTitle(trim($field['keywords']));
     $field['mapFid'] && $so->setFid($field['mapFid']);
     //修正后的fids
     $field['special'] && $so->setSpecial($field['special']);
     $field['istop'] && $so->setTopped($field['istop']);
     $field['ispic'] && $so->setHasImage($field['ispic']);
     //$field['isattach'] && $so->setIsattach($field['isattach']);
     $field['isdigest'] && $so->setDigest($field['isdigest']);
     $field['createdtime'] && $so->setCreateTimeStart($time - intval($field['createdtime']));
     $field['createdtime'] && $so->setCreateTimeEnd($time);
     $field['posttime'] && $so->setLastpostTimeStart($time - intval($field['posttime']));
     $field['posttime'] && $so->setLastpostTimeEnd($time);
     switch ($order) {
         case '2':
             $so->orderbyLastPostTime(false);
             break;
         case '1':
             $so->orderbyCreatedTime(false);
             break;
         case '3':
             $so->orderbyReplies(false);
             break;
         case '4':
             $so->orderbyHits(false);
             break;
         case '5':
             $so->orderbyLike(false);
             break;
     }
     $list = Wekit::load('forum.PwThread')->searchThread($so, $limit, $offset);
     return $this->_buildSignKey($list, $field['ishighlight']);
 }
コード例 #8
0
 public function searchthreadAction()
 {
     list($page, $perpage, $keyword, $created_username, $time_start, $time_end, $fid, $digest, $created_userid, $created_ip, $hits_start, $hits_end, $replies_start, $replies_end) = $this->getInput(array('page', 'perpage', 'keyword', 'created_username', 'time_start', 'time_end', 'fid', 'digest', 'created_userid', 'created_ip', 'hits_start', 'hits_end', 'replies_start', 'replies_end'));
     if ($created_username) {
         $user = $this->_getUserDs()->getUserByName($created_username);
         if (!$user) {
             $this->showError(array('USER:exists.not', array('{username}' => $created_username)));
         }
         if ($created_userid) {
             $created_userid != $user['uid'] && $this->showError('USER:username.notequal.uid');
         }
         $created_userid = $user['uid'];
     }
     // dm条件
     Wind::import('SRV:forum.vo.PwThreadSo');
     $dm = new PwThreadSo();
     $keyword && $dm->setKeywordOfTitleOrContent($keyword);
     if ($fid) {
         $forum = Wekit::load('forum.PwForum')->getForum($fid);
         if ($forum['type'] != 'category') {
             $dm->setFid($fid);
         } else {
             $srv = Wekit::load('forum.srv.PwForumService');
             $fids = array(0);
             $forums = $srv->getForumsByLevel($fid, $srv->getForumMap());
             foreach ($forums as $value) {
                 $fids[] = $value['fid'];
             }
             $dm->setFid($fids);
         }
     }
     $created_userid && $dm->setAuthorId($created_userid);
     $time_start && $dm->setCreateTimeStart(Pw::str2time($time_start));
     $time_end && $dm->setCreateTimeEnd(Pw::str2time($time_end));
     $digest && $dm->setDigest($digest);
     $hits_start && $dm->setHitsStart($hits_start);
     $hits_end && $dm->setHitsEnd($hits_end);
     $replies_start && $dm->setRepliesStart($replies_start);
     $replies_end && $dm->setRepliesEnd($replies_end);
     $created_ip && $dm->setCreatedIp($created_ip);
     $dm->setDisabled(0)->orderbyCreatedTime(false);
     $count = $this->_getThreadDs()->countSearchThread($dm);
     if ($count) {
         $page = $page ? $page : 1;
         $perpage = $perpage ? $perpage : $this->perpage;
         list($start, $limit) = Pw::page2limit($page, $perpage);
         $threads = $this->_getThreadDs()->searchThread($dm, $limit, $start);
     }
     $this->setOutput($count, 'count');
     $this->setOutput($page, 'page');
     $this->setOutput($perpage, 'perpage');
     $this->setOutput(array('keyword' => $keyword, 'created_username' => $created_username, 'time_start' => $time_start, 'time_end' => $time_end, 'fid' => $fid, 'digest' => $digest, 'created_userid' => $created_userid, 'created_ip' => $created_ip, 'hits_start' => $hits_start, 'hits_end' => $hits_end, 'replies_start' => $replies_start, 'replies_end' => $replies_end), 'args');
     $this->setOutput($this->_getFroumService()->getForumList($fid), 'forumList');
     $this->setOutput($this->_getFroumService()->getForumOption($fid), 'option_html');
     $this->setOutput($threads, 'threads');
 }