/** * 自媒体中心 */ public function indexAction() { $aParam = $this->getParams(); $aParam['type'] = isset($aParam['type']) ? intval($aParam['type']) : Model_Media::TYPE_WEIXIN; $iAdID = (int) $this->getParam('id'); $aAd = null; if ($iAdID > 0) { $aAd = Model_Ad::getDetail($iAdID); } if (!empty($aAd)) { $aParam['type'] = $aAd['iMediaType']; $sReferer = $this->getRequest()->getHttpReferer(); if (strpos($sReferer, '/ad/add') > 0) { if (!empty($aAd['sCatID'])) { $aParam['catid'] = intval($aAd['sCatID']); } if (!empty($aAd['sCityID'])) { $aParam['city'] = explode(',', $aAd['sCityID']); } } } $aData = Model_Media::search($aParam); foreach ($aData['aList'] as &$aRow) { $aRow['sCatName'] = Model_Media::getCategoryNames($aRow['iMediaID']); } switch ($aParam['type']) { case Model_Media::TYPE_WEIXIN: $aData['aType'] = Model_Domain::getOption(Model_Domain::TYPE_MEDIA_WEIXIN_CATEGORY); $aData['aTag'] = Model_Domain::getOption(Model_Domain::TYPE_MEDIA_WEIXIN_TAG); break; case Model_Media::TYPE_FRIEND: $aData['aType'] = Model_Domain::getOption(Model_Domain::TYPE_MEDIA_FRIEND_CATEGORY); $aData['aTag'] = Model_Domain::getOption(Model_Domain::TYPE_MEDIA_FRIEND_TAG); break; case Model_Media::TYPE_WEIBO: $aData['aType'] = Model_Domain::getOption(Model_Domain::TYPE_MEDIA_WEIBO_CATEGORY); $aData['aTag'] = Model_Domain::getOption(Model_Domain::TYPE_MEDIA_WEIBO_TAG); break; case Model_Media::TYPE_NEWS: $aData['aType'] = Model_Domain::getOption(Model_Domain::TYPE_MEDIA_NEWS_CATEGORY); $aData['aTag'] = Model_Domain::getOption(Model_Domain::TYPE_MEDIA_NEWS_TAG); break; } $aData['aPrice'] = Model_Price::getOption(); $aData['aFollower'] = Model_Follower::getOption(); $aData['aCity'] = Model_City::getPairCitys(Model_City::TYPE_FRONT); $aData['aLevel'] = Model_Domain::getOption(Model_Domain::TYPE_MEDIA_RECOMMEND); $aData['aAd'] = $aAd; if (!empty($aData['aAd'])) { $aData['aChooseID'] = Model_AdMedia::getCol(array('where' => array('iStatus >' => 0, 'iAdID' => $iAdID)), 'iMediaID'); } if (empty($aData['aChooseID'])) { $sCookieKey = 'media_choose_' . $aParam['type']; $aData['aChooseID'] = !empty($_COOKIE[$sCookieKey]) ? explode(',', $_COOKIE[$sCookieKey]) : array(); } $aData['aChoose'] = array(); foreach ($aData['aChooseID'] as $k => $v) { $aMedia = Model_Media::getDetail($v); if (empty($aMedia)) { continue; } $aData['aChoose'][] = $aMedia; } $this->assign('aData', $aData); $this->assign('aParam', $aParam); $this->assign('sTopMenu', empty($aAd) ? 'media' : 'aadd'); $this->setMeta('media_center', array('sTitle' => '媒体中心')); }