function actionView()
 {
     header('Content-type: application/json');
     if (!IjoyPlusServiceUtils::validateAPPKey()) {
         IjoyPlusServiceUtils::exportServiceError(Constants::APP_KEY_INVALID);
         return;
     }
     //		if(Yii::app()->user->isGuest){
     //			IjoyPlusServiceUtils::exportServiceError(Constants::SEESION_IS_EXPIRED);
     //			return ;
     //		}
     $thread_id = Yii::app()->request->getParam("thread_id");
     if (!isset($thread_id) || is_null($thread_id)) {
         IjoyPlusServiceUtils::exportServiceError(Constants::PARAM_IS_INVALID);
         return;
     }
     $comment = CacheManager::getCommentCache($thread_id);
     if ($comment === null) {
         IjoyPlusServiceUtils::exportEntity(array('comment' => array()));
     } else {
         $temp = IjoyPlusServiceUtils::transferComments($comment);
         $comments = Comment::model()->getCommentReplies($thread_id, 10, 0);
         $commentTemps = array();
         if (isset($comments) && is_array($comments)) {
             foreach ($comments as $comment) {
                 $commentTemps[] = IjoyPlusServiceUtils::transferComments($comment);
             }
         }
         $temp->replies = $commentTemps;
         IjoyPlusServiceUtils::exportEntity(array('comment' => $temp));
     }
 }
Exemplo n.º 2
0
 public static function getCommentProgram($thread_id)
 {
     $comment = CacheManager::getCommentCache($thread_id);
     if (isset($comment) && !is_null($comment)) {
         $prod = CacheManager::getProgramCache($comment->content_id);
         if (isset($prod) && !is_null($prod)) {
             return array('id' => $prod->d_id, 'name' => $prod->d_name, 'poster' => $prod->d_pic, 'type' => $prod->d_type);
         }
     }
     return array('id' => '', 'name' => '', 'poster' => '', 'type' => '');
 }