/**
  * 空间首页列出审核过的贴子
  * 
  * @access public
  * @return void
  */
 public function run()
 {
     $spaceUid = $this->getInput('uid', 'get');
     $page = $this->getInput('page', 'get');
     //
     $space = new PwSpaceModel($spaceUid);
     $space->setTome($spaceUid, $this->uid);
     //
     $tids = $this->_getPwNativeThreadDs()->getThreadListByUid($spaceUid, $page, $this->uid == $spaceUid ? 'my' : 'space');
     $myThreadList = $this->_getPwNativeThreadDs()->getThreadContent($tids);
     //pids 默认是0;
     $attList = $this->_getPwNativeThreadDs()->getThreadAttach($tids, array(0));
     $threadList = $this->_getPwNativeThreadDs()->gather($myThreadList, $attList);
     //
     $prev_val = '';
     $_tids = $_threadList = array();
     foreach ($threadList as $k => $v) {
         $_created_time = Pw::time2str($v['created_time'], 'auto');
         list($_key, $_time) = explode(' ', $_created_time);
         if (!preg_match('/-/', $_created_time)) {
             $_key = '今天';
         }
         if ($prev_val != $_key) {
             $threadList[$k]['barName'] = $_key;
             $prev_val = $_key;
         } else {
             $threadList[$k]['barName'] = '';
         }
         $_threadList[] = $threadList[$k];
         $_tids[] = $v['tid'];
     }
     //获得登陆用户是否喜欢过帖子|回复
     $threadLikeData = array();
     if ($this->uid && $_tids) {
         $_threadLikeData = $this->_getLikeReplyService()->getAllLikeUserids(PwLikeContent::THREAD, $_tids);
         foreach ($_tids as $v) {
             if (isset($_threadLikeData[$v])) {
                 $threadLikeData[$v] = array_search($this->uid, $_threadLikeData[$v]) === false ? 0 : 1;
             }
         }
     }
     //帖子发布来源
     $threadFromtypeList = $this->_getThreadsPlaceService()->getThreadFormTypeByTids($_tids);
     $location_text = Wekit::loadDao('native.dao.PwNativeThreadsDao')->getCityByUid($spaceUid);
     $location_text || ($location_text = Wekit::loadDao('native.dao.PwPostsPlaceDao')->getCityByUid($spaceUid));
     $location_text || ($location_text = $space->spaceUser['location_text']);
     $data = array('uid' => $this->uid, 'userInfo' => isset($space->spaceUser) ? array('username' => $space->spaceUser['username'], 'gender' => $space->spaceUser['gender'], 'location_text' => $location_text, 'avatar' => Pw::getAvatar($spaceUid), 'attentionNum' => $space->spaceUser['follows'], 'fansNum' => $space->spaceUser['fans']) : array('username' => '', 'gender' => 0, 'location_text' => '', 'avatar' => '', 'attentionNum' => 0, 'fansNum' => 0), 'tome' => isset($space->tome) ? $space->tome : 0, 'pageCount' => $this->_getPwNativeThreadDs()->getThreadPageCount(), 'threadList' => $_threadList, 'threadFromtypeList' => $threadFromtypeList);
     $this->setOutput($data, 'data');
     $this->showMessage('success');
 }
 public function myAction()
 {
     Wind::import('SRV:space.bo.PwSpaceModel');
     $spaceUid = $this->loginUser->uid;
     $space = new PwSpaceModel($spaceUid);
     if (!$space->space['uid']) {
         $this->showError('login.not');
     }
     $space->setTome($spaceUid, $this->loginUser->uid);
     $space->setVisitUid($this->loginUser->uid);
     $torrents = $this->_getTorrentSubscribeDs()->getTorrentSubscribeByUid($this->loginUser->uid);
     $this->setTheme('space', $space->space['space_style']);
     $this->setOutput($space, 'space');
     $this->setOutput($torrents, 'torrents');
     $this->setOutput('my', 'src');
     // seo设置
     Wind::import('SRV:seo.bo.PwSeoBo');
     $seoBo = PwSeoBo::getInstance();
     $lang = Wind::getComponent('i18n');
     $seoBo->setCustomSeo($lang->getMessage('SEO:space.profile.run.title', array($space->spaceUser['username'], $space->space['space_name'])), '', $lang->getMessage('SEO:space.profile.run.description', array($space->spaceUser['username'])));
     Wekit::setV('seo', $seoBo);
 }
Exemple #3
0
 function getSpaceData($models)
 {
     require_once R_P . 'u/lib/spacemodel.class.php';
     $spacemodel = new PwSpaceModel($this);
     return $spacemodel->get($this->uid, $models);
 }