public function deletePic($request, $response) { $thesisId = $request->thesisId; ThesisClient::getInstance()->modifyThesisPicurl($thesisId); $response->setRedirect($response->router->urlfor('thesis/showlist', array('category' => 2, 'page' => $request->page))); }
public function healthNews($request, $response) {/*{{{*/ $page = $request->page?$request->page:1; $pageSize = 50; $articleIds = array(); $zhuantiIds = array(); $articleDiseases = array(); $zhuantis = array('list' => array()); $articles = ArticleClient::getInstance()->getArticleList4Baidu($page,$pageSize); $this->sortHealthNewsArray($articles['list'], 'ctime'); $firstArticle = array_shift($articles['list']); $lastArticle = array_pop($articles['list']); array_push($articles['list'], $lastArticle); array_unshift($articles['list'], $firstArticle); $articles['list'] = array_filter($articles['list']); // if ($firstArticle && $lastArticle) { // $zhuantis = ZhuanTiClient::getInstance()->getZhuanTiList4Baidu($lastArticle->ctime, $firstArticle->ctime); } foreach ($articles['list'] as $article) { $articleIds[] = $article->id; } if (false == empty($articleIds)) { $articleDiseases = DiseaseClient::getInstance()->getDiseaseLablesByObjIds($articleIds, 'article', $pageSize); } if($page == 1) { $papers = array('list'=>array()); $papers['list'] = PaperClient::getInstance()->queryOnlinePaperList(XDateTime::now()->addDay(-10)); $thesiss = array('list'=>array()); $thesiss['list'] = ThesisClient::getInstance()->queryThesisOnlineList(XDateTime::now()->addDay(-10)); $news = $articles['list'] + $zhuantis['list'] + $papers['list'] + $thesiss['list']; } else { $news = $articles['list'] + $zhuantis['list']; } $this->sortHealthNewsArray($news, 'ctime'); $pagelink = PageNav::getNavLink(PageNav::getPageNavTemplate("?page="), $articles['pageInfo']['nowpage'], $pageSize, $articles['pageInfo']['total']); $response->news = $news; $response->articleDiseases = $articleDiseases; $response->pagelink = $pagelink; }/*}}}*/
public function showList($request, $response) {/*{{{*/ //$response->keywords = ''; //$response->description = ''; $response->csss = array( 'http://i1.hdfimg.com/www/cms/css/content_thesis.css?20140722', 'http://i1.hdfimg.com/www/cms/css/thesis.css?20140722' ); $nowPage = $request->getRequest('page', 1); $pageSize = 50; $category = $request->category; if (CmsObjCategory::SHIPIN == $category) { $pageSize = 36; } $paperId = $request->paperId; $tagId = $request->tagId; $diseaseId = $request->diseaseId; if(false == empty($category)) { $pageTitle = CmsObjCategory::getDesc($category) . '_好大夫在线'; if (isset($diseaseId) && false == (empty($diseaseId))) { $disease = DAL::get()->find('disease', $diseaseId); if (false == $disease->isNull()) { $pageTitle = $disease->name."_".$pageTitle; } $response->diseaseName = $disease->name; } $response->title = $pageTitle; } elseif(false == empty($paperId)) { $paper = DAL::get()->find('Paper', $paperId); $response->paper = $paper; $response->paperTag = CmsObjCategory::getDesc($paper->getMasterTag()->relateObjId); $response->paperTagId = $paper->getMasterTag()->relateObjId; $response->title = $paper->title. '文章列表_好大夫在线'; $response->paperTitle = $paper->title; } $response->searchWords = $this->getHotSearchWords(); //thesis列表 $cmsList = array(); $options = array('nowPage' => $nowPage, 'pageSize' => $pageSize); if (false == empty($category) && array_key_exists($category, CmsObjCategory::getDescArray4Paper())) { $options['status'] = Paper::STATUS_ONLINE; list($cmsList, $pageInfo) = PaperClient::getInstance()->queryValidPaperListByCategory($category, $options); } else if (false == empty($category) && array_key_exists($category, CmsObjCategory::getDescArray4Thesis())) { $options['status'] = Thesis::STATUS_ONLINE; if (isset($diseaseId)) { $options['diseaseId'] = $diseaseId; } list($cmsList, $pageInfo) = ThesisClient::getInstance()->queryThesisListByType($category, $options); } else if (false == empty($paperId) && empty($category)) { $options['status'] = Thesis::STATUS_ONLINE; $options['relateType'] = CmsTagType::PAPER; list($cmsList, $pageInfo) = ThesisClient::getInstance()->queryThesisListByType($paperId, $options); } else if (empty($paperId) && empty($category) && false == empty($tagId)) { $options['status'] = Thesis::STATUS_ONLINE; $options['tagId'] = $tagId; list($cmsList, $pageInfo) = ThesisClient::getInstance()->queryThesisListByType($tagId, $options); } $response->cmsList = $cmsList; $response->pageLink = empty($cmsList) ? array() : PageNav::getNavLink(PageNav::getPageNavTemplate("showlist?category=$category&paperId=$paperId&tagId=$tagId&page="),$pageInfo['nowpage'],$pageInfo['pagesize'],$pageInfo['total']); $response->category = $category; $response->tagId = $tagId; if (isset($diseaseId) && false == (empty($diseaseId))) { $response->diseaseId = $diseaseId; } //咨询列表 if (isset($diseaseId) && false == (empty($diseaseId))) { $disease = DAL::get()->find('disease', $diseaseId); if (false == $disease->isNull()) { $flowList = RelationSearchClient::getInstance()->getFlowListFromRelevantSearch($disease->name, 8); $flowList = array_slice($flowList, 0, 8); $response->flowList = $flowList; } else { $response->flowList = FlowClient::getInstance()->getLatestFlowList(8); } } else { $response->flowList = FlowClient::getInstance()->getLatestFlowList(8); } if (isset($diseaseId) && false == (empty($diseaseId))) { $this->getPhoneList($diseaseId, $response); } else { //电话咨询 $diseaseIds_shuffle = self::$diseaseIds; shuffle($diseaseIds_shuffle); $this->getPhoneList(array_pop($diseaseIds_shuffle), $response); } //好文推荐 if ($category != CmsObjCategory::HAOWEN) { $this->getHaowenList($request, $response); } }/*}}}*/
private function getHaowenList($request, $response) {/*{{{*/ list($thesisList, $pageInfo)= ThesisClient::getInstance()->queryThesisListByType(CmsObjCategory::HAOWEN, array('limit' => 7, 'status' => Thesis::STATUS_ONLINE)); $response->haowenList = empty($thesisList) ? array() : $thesisList; }/*}}}*/
private function article2013imp($request,$response, $diseasePage) { $pageSize = 10; $page = $request->page; $page = $page ? $page : 1; $relateobjid = $request->relateobjid; $lableid = $request->lableid; $rootLableId = $request->rootLableId; $type = $request->type; $lableName = "疾病知识"; if ($rootLableId) { $lableList = LableDefine::getRootLableList(); $lableName = $lableList[$rootLableId]; } else if ($lableid) { $lableName = LableDefine::getLableTitle($lableid); } else if ($type) { if ("thesis" == $type) { $lableName = "采访报道"; } else if ("article" == $type) { $lableName = "医生文章"; } } if(stripos($_SERVER['REQUEST_URI'], 'lableid=') || stripos($_SERVER['REQUEST_URI'], 'rootLableId=') || stripos($_SERVER['REQUEST_URI'], 'type=') ) { $jumpUrl = $diseasePage->getArticleUrl($diseasePage->disease->key, $lableid, $type, $rootLableId); if ($page > 1) { $jumpUrl .= "?page=$page"; } $response->exitJump($jumpUrl, 301); } $response->diseasePage = $diseasePage; $response->lableid = $lableid; $response->rootLableId = $rootLableId; $response->type = $type; $response->lableName= $lableName; if($type == 'article') { $statusSql = ' and status=1 '; $res = DiseaseClient::getInstance()->getArticleByDiseaseIdAndLabelIdWithPageInfo($diseasePage->disease->id, $lableid, $page, $pageSize, 2, $statusSql); }elseif($type == 'thesis') { // $statusSql = ' and status=1 '; // $res = DiseaseClient::getInstance()->getThesisByDiseaseIdAndLabelIdWithPageInfo($diseasePage->disease->id, $lableid , $page, $pageSize,$statusSql); $options = array(); $options['nowPage'] = isset($_GET['page']) ? $_GET['page'] : 1; $options['pageSize'] = 10; $options['diseaseId'] = $diseasePage->disease->id; $options['status'] = 1; list($thesiss,$pageInfo) = ThesisClient::getInstance()->queryThesisListByType(CmsObjCategory::SHENGYIN, $options); $res = array(); $res['data'] = $thesiss; $res['pageInfo'] = $pageInfo; }else { if (false == empty($rootLableId)) { $lableid = $diseasePage->getLeafLablesOfRootLable($rootLableId); } $res = DiseaseClient::getInstance()->getArticleIdsAndThesisIdsByDiseaseIdAndLableId($diseasePage->disease->id, $lableid, $page, $pageSize); } $arr = $res['data']; $response->arr = $arr; $response->pageInfo = $res['pageInfo']; $response->pagelink = ''; $response->page = 1; if(false == empty($res['pageInfo'])) { $response->page = $res['pageInfo']['nowpage']; $response->pagelink = PageNav::getNavLink( PageNav::getPageNavTemplate4DiseasePage($diseasePage->getArticleUrl($diseasePage->disease->key, $lableid, $type, $rootLableId).'&page='), $res['pageInfo']['nowpage'],$res['pageInfo']['pagesize'],$res['pageInfo']['total']); } $papers = $diseasePage->queryPapersByRelateobjid($relateobjid); $response->papers = $papers; $disease=$this->disease; $ddCnt = DiseaseClient::getInstance()->getDiseaseDoctorCnt($this->disease->id); $title=$disease->name."知识_好大夫在线"; $keywords=$disease->name."知识,".$disease->name."基础知识"; $description="中国最大的医疗网站-好大夫在线为您提供".$disease->name."基础知识,".$disease->name."专家文章,推荐".$ddCnt."位".$disease->name."专家、".$res['pageInfo']['total']."篇".$disease->name."专家文章,更多".$disease->name."专家观点。"; $response->title=$title; $response->keywords=$keywords; $response->description=$description; }/*}}}*/