/**
     * @brief 收藏列表
     *
     * @param $userId
     * @param $deviceToken
     * @param $types
     *
     * @return 
  */
 public function showCollectionList($userId, $deviceToken, $types = array())
 {/*{{{*/
     if(empty($deviceToken) && empty($userId))
     {
         $this->setErrorCode(327);
         return 0;
     }
     $collectionList = array();
     if(false == isset($types) || empty($types))
     {
         $types = array(1,3,4,5,6,7);
     }
     $collectionList = MobileBookingClient::getInstance()->showCollectionList($userId, $deviceToken, $types);
     $infos = array();  
     if(false == empty($collectionList))
     {
         foreach($collectionList  as $key => $collection)
         {
             if(false == empty($collection))
             {
                 $collectionEntity= $collectionList[$key]['collectionEntity'];
                 $collectionType = $collectionList[$key]['collectionType'];
                 $info['collectionId'] = $collectionEntity->id;
                 $info['collectionKey'] = '';
                 if($collectionEntity->isNull())
                 {
                     continue;
                 }
                 if(AppBookingRef::COLLECT_TYPE_HOSPITAL == $collectionType)
                 {
                     $info['collectionType'] = $info['collectionTrueType'] = $collectionType;
                     $info['collectionContent'] = $collectionEntity->name;
                 }
                 if(AppBookingRef::COLLECT_TYPE_FACULTY == $collectionType)
                 {
                     $info['collectionType'] = $info['collectionTrueType'] = $collectionType;
                     $info['collectionContent'] = $collectionEntity->name;
                 }
                 if(AppBookingRef::COLLECT_TYPE_DOCTOR == $collectionType)
                 {
                     $info['collectionType'] = $info['collectionTrueType'] = $collectionType;
                     $info['collectionContent'] = $collectionEntity->name;
                 }
                 if(AppBookingRef::COLLECT_TYPE_ARTICLE == $collectionType)
                 {
                     $info['collectionType'] = $info['collectionTrueType'] = $collectionType;
                     $info['collectionContent'] = $collectionEntity->title;
                 }
                 if(AppBookingRef::COLLECT_TYPE_DISEASE == $collectionType || AppBookingRef::TYPE_DISEASE == $collectionType)
                 {
                     $info['collectionType'] = AppBookingRef::COLLECT_TYPE_DISEASE;
                     $info['collectionTrueType'] = $collectionType;
                     $info['collectionKey'] = $collectionEntity->key;
                     $info['collectionContent'] = $collectionEntity->name;
                 }
                 $infos[] = $info;
             }
         }
     }
     $this->content = $infos;
 }/*}}}*/
Ejemplo n.º 2
0
 /**
  * 新版客户端获取订阅文章列表
  * @author:whd 
  **/
 public function getNewBookingArticleList($userId, $deviceToken, $latestArticleId=0)
 {/*{{{*/
     $limit = 11;
     $type = AppBookingRef::TYPE_DISEASE; 
     if(empty($deviceToken) && empty($userId))
     {
         $this->content = array();
     }
     else
     {
         $diseaseList = array();
         $diseaseList = MobileBookingClient::getInstance()->showBookedDisease($userId, $deviceToken, $type);
         $diseaseIds = array_keys($diseaseList);
         $latestArticleId = (int)$latestArticleId;
         $options = array();
         $options['level'] = 2;
         $articleList = ArticleClient::getInstance()->getLatestArticleListByDiseaseIds($diseaseIds, $latestArticleId, $options, $limit);
         $hasMore = 1;
         if (count($articleList) < $limit)
         {
             $hasMore = 0;
         }
         $articleList = array_slice($articleList, 0, $limit - 1);
         $this->content = $this->getCommonArticleInfos($articleList);
         $this->hasMore = $hasMore;
     }
 }/*}}}*/