public function actionComment()
 {
     $appID = Yii::app()->request->getParam('appID');
     $content = Yii::app()->request->getParam('content');
     $replayId = Yii::app()->request->getParam('replayId', 0);
     if (!Yii::app()->request->isPostRequest || empty($content) || empty($appID)) {
         throw new THttpException('评论失败');
     }
     $app = AppInfoList::model()->findByPk($appID);
     if (!$app instanceof AppInfoList) {
         throw new THttpException('评论失败');
     }
     //被回复的评论
     $pid = 0;
     $toAuthorID = 0;
     if ($replayId) {
         $replay = AppReviews::model()->findByPk($replayId);
         if (!$replay instanceof AppReviews) {
             throw new THttpException('评论失败');
         }
         if ($replay->Pid) {
             $pid = $replay->Pid;
         } else {
             $pid = $replay->Id;
         }
         if ($replay->AuthorId) {
             $toAuthorID = $replay->AuthorId;
         }
     }
     if ($toAuthorID) {
         $toAuthor = User::model()->findByPk($toAuthorID);
         if (!$toAuthor instanceof User) {
             throw new THttpException('评论失败');
         }
     }
     $userID = Yii::app()->user->id;
     $user = User::model()->findByPk($userID);
     if (!$user instanceof User || $userID == $toAuthorID) {
         throw new THttpException('评论失败');
     }
     $content = AppReviews::filterComment($content);
     $id = AppReviews::comment($app->Id, $user, $content, $pid, $toAuthorID);
     if ($id) {
         $return = array();
         $return['id'] = $id;
         $return['pid'] = $pid;
         $return['authorID'] = $userID;
         $return['content'] = $content;
         $return['username'] = htmlspecialchars($user->UserName);
         $return['authorIcon'] = $user->Icon;
         $return['toAuthorID'] = $toAuthorID;
         $return['toAuthorUserName'] = $toAuthorID ? htmlspecialchars($toAuthor->UserName) : '';
         echo new ReturnInfo(RET_SUC, $return);
     }
 }