コード例 #1
0
    public function detail($request, $response)
    {/*{{{*/
		$articleId = intval($request->getRequest('article_id', 0));
		$article = DAL::get()->find('article', $articleId);
        if($article->isNull())
        {
            $this->_exit404();
        }
        DBC::requireFalse($article->isDelete(), "文章已经被删除了!");
        DBC::requireFalse($article->isShield(), "文章正在审核中!");
        if ($article->isAuditing())
        {
            $result = $this->filterArticle($article);
            if (false == empty($result['title']) || false == empty($result['content']))
            {
                DBC::requireFalse(true, "文章正在审核中!");
            }
        }
        $isShare = $request->getRequest('isShare', '');
        //分享文章阅读量统计
        if(false == empty($isShare))
        {
            HitClient::getInstance()->increaseArticleHitsForShare($article->id);
        }
        $response->article = $article;
        $response->topTitle = XString::truncate($article->title, 18);
        $response->title = $article->title."_好大夫在线";

        $articleAttachmentRef = new NullEntity();
        if ($article->hasDocAttachment())
        {
            $articleAttachmentRef = ArticleClient::getInstance()->getValidAttachmentRef($article->id);
        }
        $response->articleAttachmentRef = $articleAttachmentRef;
    }/*}}}*/
コード例 #2
0
    /**
        * @brief 获取医生的文章列表 
        * @author 
        * @exampleUrl http://dev.mobile-api.haodf.com/patientapi/article_getDoctorArticleList?userId=581662815&pageId=1&pageSize=10
        *
        * @Param $doctorId 用户id
        * @Param $pageSize 每页显示数
        * @Param $nowPage 当前页码
        *
        * @Returns array('id', 'sn', 'price', 'statusDesc', 'flowId', 'spaceId', 'doctorName', 'hospitalName', 'hospitalFacultyName', 'alertMsg', 'needPay', 'caseType', 'doctorAssistant', 'doctorAssistantTel');
     */
    public function getDoctorArticleList($userId, $doctorId, $pageSize = 10, $pageId = 1)
    {/*{{{*/
        $doctor = DAL::get()->find('doctor', $doctorId);
        $user = DAL::get()->find('user', $userId);
        if($userId != $this->currentUserId)
        {
            $this->setErrorCode(309);
            return 0;
        }
		if ($user->isNull() || $user->id == 0)
		{
            $this->setErrorCode(107);
            return 0;
        }
        if($doctor->isNull())
        {
            $this->setErrorCode(132);
            return 0;
        }
    	if ($doctor->space->isNull())
        {
            $this->setErrorCode(144);
            return 0;
        }
		$res = ArticleClient::getInstance()->getList($doctor->space->id, '', $pageId, $pageSize, array('articleLevel' => Article::LEVEL_2, 'orderby' => 'topLevel desc, fld_ArticleCreateTime desc'));
        $myDoctor = DAL::get()->find_by_userIdAndDoctorId('userdoctor', $userId, $doctor->id);
        $results = array();
        $articleIds = array();
        foreach($res['articleList'] as $article)
        {
            $result = array();
            $result['id'] = $article->id;
            $result['title'] = $article->title;
            $result['doctorName'] = $article->space->host->name." ".$article->space->host->hospitalfaculty->hospital->commonName;
            $result['content'] = XString::truncate(str_replace(array("\n", "\t", "\r", " "), "", strip_tags(htmlspecialchars_decode($article->content))), 50); 
            $result['ctime'] = $article->ctime;
            $result['hits'] =  HitClient::getInstance()->getArticleHitsForMobile($article->id) + $article->hits;
            $result['url'] = '';
            $result['type'] = "article";
            $result['isSelfOwner'] = 0;
            $result['subscriptionId'] = $myDoctor->id;
            $result['subscriptionType'] = 'userdoctor';
            $articleIds[] = $article->id;
            $results[$article->id] = $result;
        }
        $readStatus = SubscriptionClient::getInstance()->getUserSubscriptionReadStatus($userId, $articleIds);
        foreach($readStatus as $contentId => $status)
        {
            $results[$contentId]['readStatus'] = $status;
        }
        $this->content = array_values($results); 
        $pageInfo['pages'] = $res['pageInfo']['pages'];
        $pageInfo['pagesize'] = $pageSize;
        $pageInfo['nowpage'] = $pageId;
        $pageInfo['total'] = $res['pageInfo']['total'];
        $this->pageInfo = $pageInfo;
    }/*}}}*/
コード例 #3
0
 private function getHits($article)
 {/*{{{*/
      return HitClient::getInstance()->getArticleHitsForMobile($article->id) + $article->hits;
 }/*}}}*/
コード例 #4
0
<div class="cate_box2 mb30">
    <div class="clearfix cate_title2 mb20">
    <p class="module2"><a target="_blank" href="<?=$diseasePage->getArticleUrl($disease->key, '', 'article')?>">医生文章</a></p>
        <p class="fr pt5">
            <a target="_blank" href="<?=$diseasePage->getArticleUrl($disease->key, '', 'article')?>" class="fs">更多<span class="f8">>></span></a>
        </p>
        <i class="b_arrow3"></i>
    </div>
    <ul class="classics fs mb15">
    <?php
        foreach($articleList as $article)
        {
            if ($article->space->host instanceof Doctor)
            {
                $space = $article->space;
                $count = (int)(HitClient::getInstance()->getHitCntByKey("article_".$article->id) + $article->hits);
                ?>
        <li>
        <a target="_blank" href="<?=$article->getUrl()?>" class="cur_t"><?=XString::truncate($article->title, 36)?></a>
            <div class="h_classics dn">
            <p class="pb10 h_t"><a target="_blank" href="<?=$article->getUrl()?>"><?=XString::truncate($article->title, 36)?></a></p>
                <p class="pb15">
                    <a target="_blank" href="<?=$article->getUrl()?>" class="g_read gray3">阅读<?=$count?></a>
                <?php 
                    $commentCount = ArticleClient::getInstance()->getCommentCount($article->id);
                    if (0 < $commentCount)
                    {
                ?>
                    <a class="g_comment gray3" target="_blank" href="<?=$article->getUrl()?>">评论<?=$commentCount?></a>
                <?php
                    }
コード例 #5
0
	private function getSpaceHits()
	{
		//return (int)(HitClient::getInstance()->getSpaceHits($this->_newSpace->id) + $this->_newSpace->hits);
		return (int)(HitClient::getInstance()->getHitCnt4Space($this->_newSpace->id) + $this->_newSpace->hits);
	}
コード例 #6
0
 private function getSpaceHits($request)
 {
     /*{{{*/
     if (false == RequestDelegate::isAjaxRequest() && false == in_array($request->controller, self::$UnRecordHitsControllers)) {
         return (int) (HitClient::getInstance()->getHitCnt4Space($this->space->id) + $this->space->hits);
     }
 }
コード例 #7
0
 private function buildSubscriptionInfo($userId, $needFlow, array $articleRes)
 {/*{{{*/
     $results = array();
     if(isset($articleRes['res']))
     {
         foreach($articleRes['res'] as $res)
         {
             $article = $res['entity'];
             $record = $res['recordEntity'];
             if($article instanceof Article)
             {
                 $result = array();
                 $result['id'] = $article->id;
                 $result['title'] = $article->title;
                 $result['doctorName'] = $article->space->host->name." ".$article->space->host->hospitalfaculty->hospital->commonName;
                 $result['content'] = XString::truncate(str_replace(array("\n", "\t", "\r", "&nbsp;"), "", strip_tags(htmlspecialchars_decode($article->content))), 50); 
                 $result['hits'] =  HitClient::getInstance()->getArticleHitsForMobile($article->id) + $article->hits;
                 $result['url'] = '';
                 $result['type'] = "article";
                 $result['isSelfOwner'] = 0;
             }
             else if($article instanceof Thesis)
             {
                 $result = array();
                 $result['id'] = $article->id;
                 $result['title'] = $article->title;
                 $result['doctorName'] = '';
                 $result['content'] = XString::truncate(str_replace(array("\n", "\t", "\r", "&nbsp;"), "", strip_tags(htmlspecialchars_decode($article->content))), 50); 
                 $result['hits'] = HitClient::getInstance()->getHitCntByKey("thesis_".$article->id) + $article->hits;
                 $result['url'] = '';
                 $result['type'] = "thesis";
                 if(in_array($article->id, $articleRes['touchThesis']))
                 {
                     $result['url'] = $article->getTouchUrl().'?from=app';
                     $result['type'] = "touchthesis";
                 }
                 $result['isSelfOwner'] = 0;
             }
             else if($article instanceof DoctorPatientRef && $needFlow == 1)
             {
                 $result = array();
                 $result['id'] = $article->id;
                 $result['title'] = $article->title;
                 $result['doctorName'] = '';
                 $result['content'] = $article->diseaseName;
                 $result['hits'] = '';
                 $result['url'] = '';
                 $result['type'] = "flow";
                 $result['isSelfOwner'] = ($article->user->id == $userId) ? 1 : 0;
             }
             $result['ctime'] = substr($record->ctime, 5, 11);
             $result['readStatus'] = $record->readState;
             $result['subscriptionId'] = $res['subscriptionId'];
             $result['subscriptionType'] = 'subscriptdisease';
             $results[$article->id] = $result;
         }
     }
     return array_values($results);
 }/*}}}*/
コード例 #8
0
 public function ajaxGetDoctorHitCnt($request, $response)
 {/*{{{*/
     $doctorId = $request->doctorid;
     $doctor = DAL::get()->find("doctor", $doctorId);
     if($doctor->isNull())
     {
         echo '0';
         return parent::DIRECT_OUTPUT;
     }
     $hitCnt = (int)(HitClient::getInstance()->getHitCnt4Doctor($doctor->id) + $doctor->hits); 
     echo $hitCnt;
     return parent::DIRECT_OUTPUT;
 }/*}}}*/
コード例 #9
0
 private function getArticles($request, $response)
 {
     /*{{{*/
     $options = array();
     $pageSize = 10;
     if ($this->isSpaceLogin()) {
         $options['articleLevel'] = Article::LEVEL_0;
         $pageSize = 20;
     }
     $articleList = ArticleClient::getInstance()->getList($this->space->id, 0, 1, $pageSize, $options);
     $response->articleCount = isset($articleList['pageInfo']['total']) ? $articleList['pageInfo']['total'] : 0;
     $newArticleList = isset($articleList['articleList']) ? $articleList['articleList'] : array();
     $newHitRes = array();
     if (false == empty($newArticleList)) {
         $articleIds = array_keys($newArticleList);
         foreach ($articleIds as $articleId) {
             $redisKey = "article_" . $articleId;
             $newHitRes[$articleId] = HitClient::getInstance()->getHitCntByKey($redisKey);
         }
         $topArticleList = array();
         $downArticleList = array();
         foreach ($newArticleList as $article) {
             if ($article->topLevel) {
                 $topArticleList[] = $article;
             } else {
                 $downArticleList[] = $article;
             }
         }
         XString::sortArray($topArticleList, 'topLevel');
         XString::sortArray($downArticleList, 'ctime');
         $newArticleList = array_merge($topArticleList, $downArticleList);
     }
     $response->articleList = $newArticleList;
     $response->hitRes = $newHitRes;
 }
コード例 #10
0
    public function articleDetail($request,$response)
    {/*{{{*/
        $this->menu($request, $response);
		$articleId = intval($request->getRequest('id', 0));
		$article = DAL::get()->find('article', $articleId);
		$response->article = $article;

        if(false == $article->isNull())
        {
            $response->articleHits = (int)(HitClient::getInstance()->getArticleHits($article->id) + $article->hits);
        }
        $response->title = $article->title.'出国看病_海外就诊_海外就医_好大夫在线';
        $response->keywords = $article->title.'出国看病,海外就诊,癌症海外就医';
    }/*}}}*/
コード例 #11
0
 /** 文章详细 zj */
 public function detail($request, $response)
 {
     /*{{{*/
     //获取文章头部医生信息
     $response->goodArticleIds = $this->getGoodArticleIds();
     $this->getDoctorInfo($request, $response);
     //获取文章信息
     $articleId = intval($request->getRequest('article_id', 0));
     $article = $this->getArticleInfo($articleId, $response);
     //是否可以分享
     $this->canShareArticle($article, $response);
     //获取文章分类
     $this->getArticleCategoryList(false, $response);
     //获取文章评论
     $res = ArticleClient::getInstance()->getCommentList($article->id);
     $response->commentList = false == empty($res) ? $res['commentList'] : array();
     //获取相关文章
     $response->relatedArticleList = ArticleClient::getInstance()->getRelateArticleList($this->space->user->id, $article->id);
     $response->articleObject = $article;
     $this->getRelationInfo($article, $response);
     $this->getReTopicInfo($article, $response);
     $response->title = $article->title . '_好大夫在线';
     $articleContentArr = explode('</P>', $article->content);
     $articleContentArr = explode('</p>', $articleContentArr[0]);
     $description = str_replace('&nbsp;', '', $articleContentArr[0]);
     $response->description = str_replace('"', '', strip_tags($description));
     $doctorAnswerPhoneList = PaymentClient::getInstance()->getDoctorSatisfactionCntList($this->space->id);
     $doctorAnswerPhoneCount = 0;
     if (false == empty($doctorAnswerPhoneList)) {
         $doctorAnswerPhoneCount = $doctorAnswerPhoneList[0]['cnt'];
     }
     $response->doctorAnswerPhoneCount = $doctorAnswerPhoneCount;
     $commentsCount = 0;
     $comments = PaymentClient::getInstance()->getDoctorSatisfactionList($this->space->host->id);
     if (false == empty($comments[$this->space->host->id]['scorecnt'])) {
         $commentsCount = $comments[$this->space->host->id]['scorecnt'];
     }
     $response->commentsCount = $commentsCount;
     $response->anyOneSpace = SpaceClient::getInstance()->getAnyOneSpace();
     $response->flows = FlowClient::getInstance()->getFlowListByUser($this->user->id, array('status' => DoctorPatientRef::STATUS_INIT, 'limit' => 10));
     $articleAttachmentRef = new NullEntity();
     if ($article->hasDocAttachment()) {
         $articleAttachmentRef = ArticleClient::getInstance()->getValidAttachmentRef($article->id);
     }
     $response->articleAttachmentRef = $articleAttachmentRef;
     $response->token = Captcha::generate('article', $article->id, ContentFactory::TYPE_ARITHMATIC, 4, XIpLocation::getIp(), 3);
     $isShare = $request->getRequest('isShare', '');
     //分享文章阅读量统计
     if (false == empty($isShare)) {
         HitClient::getInstance()->increaseArticleHitsForShare($article->id);
     }
     if ($this->space->isPhoneOpenedForFront($this->user->id)) {
         $telVisitList = PaymentClient::getInstance()->getPatientPhoneServiceList($this->space->user->id, 1, 10);
         $response->telVisitTotalCnt = isset($telVisitList['pageInfo']['total']) ? $telVisitList['pageInfo']['total'] : 0;
         $telVisitInfos = DAL::get()->queryLatestCompleteOrderIdsBySpaceId('TelOrder', $this->space->user->id, $count = 10);
         $response->telVisitInfos = $telVisitInfos;
         $options['status'] = array(TelOrder::STATUS_FINISHED, TelOrder::STATUS_CLOSED);
         $response->telOrderCount = TelOrderClient::getInstance()->getOrderCount4Space($this->space->id, $options);
     }
     $response->doctorServices = SpaceClient::getInstance()->getServiceInfo($this->space->id, $this->user->id);
     if ($this->isSpaceLogin()) {
         return 'detail4space';
     } else {
         return "detail4browser";
     }
 }
コード例 #12
0
 private function getArticleNewHits($articleIds)
 {/*{{{*/
     $newHitRes = array();
     foreach($articleIds as $articleId)                                                
     {                                                                                 
         $redisKey = "article_".$articleId;                                            
         $newHitRes[$articleId] = HitClient::getInstance()->getHitCntByKey($redisKey); 
     }                                                                                 
     return $newHitRes;
 }/*}}}*/
コード例 #13
0
	private function _getArticleList($categoryId, $classicCategoryId, $request, $response) {
		$page = intval($request->getRequest('p', 1));
        $options = array();
        if(false == $this->_newUser->isNull() && $this->_newUser->id == $this->_newSpace->user->id)
        {
            $options['articleLevel'] = Article::LEVEL_0;
            $options['orderby'] = 'fld_ArticleUpdateTime desc';
        }
		$res = ArticleClient::getInstance()->getList($this->_newSpace->id, $categoryId, $page, $pageSize=20, $options);
		$articleList = $res['articleList'];
        $response->articleList = $articleList;
		$pagelink = "";
		if(isset($res['pageInfo']) &&  empty($res['pageInfo']) == false){
			$pageInfo = $res['pageInfo'];
			$pagelink = PageNav::getNavLink(PageNav::getPageNavTemplate("?category_id=$categoryId&p="), $pageInfo['nowpage'], $pageInfo['pagesize'], $pageInfo['total']);
		}
		
		if($categoryId)
			$category = DAL::get()->find('ArticleCategory', $categoryId);
		else
			$category = new NullEntity();
		$response->category = $category;
		$response->categoryId = $categoryId;
		$response->isClassicsCase = ($categoryId == $classicCategoryId);

        $newHitRes = array();
        if (false == empty($articleList) && ($this->_newUser->isNull() || $this->_newSpace->id != $this->_newUser->id))
        {
            $hitRes = HitClient::getInstance()->getHitsNoCache(array_keys($articleList));
            $articleIds = array_keys($articleList);
            foreach($articleIds as $articleId)
            {
                $redisKey = "article_".$articleId;
                $newHitRes[$articleId] = HitClient::getInstance()->getHitCntByKey($redisKey);
            }
        }
        $response->hitRes = $newHitRes; 
        if ($this->_spaceIsLogin)
        {
            $response->maxTop = ArticleClient::getInstance()->getMaxTopLevel($this->_newSpace->id, $isAll=false);
            $response->minTop = ArticleClient::getInstance()->getMinTopLevel($this->_newSpace->id);
        }
		$response->pagelink = $pagelink;

        $response->blueId = $request->blueId;
		
        $this->_getArticleCategoryList(false, $response);
	}