public function get_more() { if (!Input::has('requestCount')) { return Response::json(array('statusCode' => 202, 'error' => 'invalid param(s).')); } try { $comments = CommentService::get_more(Input::get('requestCount')); } catch (Exception $e) { return Response::json(array('statusCode' => 202, 'error' => 'database error occur.')); } return Response::json(array('statusCode' => 200, 'comments' => $comments)); }
<?php require_once '../config.php'; require_once ykfile('source/comment_service.php'); header("application/json;charset=utf-8"); $act_id = intval($_GET['act_id']); if ($act_id < 0) { $act_id = 0; } $next_id = intval($_GET['next_id']); if ($next_id < 0) { $next_id = 0; } $count = intval($_GET['count']); if ($count <= 0 || $count > 300) { $count = 10; } $comsrv = new CommentService(); $total = $comsrv->get_count_by_act($act_id); $comments = $comsrv->get_comments($act_id, $next_id, $count); echo json_encode(array("total" => $total, "comments" => $comments));
<?php require_once ykfile('source/comment_service.php'); $com_id = intval($_GET['com_id']); $comsrv = new CommentService(); $ret = $comsrv->remove_comment($com_id); if ($ret) { echo json_encode(array('status' => 0, 'message' => '删除成功')); } else { echo json_encode(array('status' => 1, 'message' => '删除失败')); }
$comments = new CommentService(); $comment = $comments->add_comment_to_article($article_id, $text); // Generate view data $user = $comment->user; $date = date("F d, Y", $comment->creation_date); $text = $comment->text; // Return comment to client include '../../app/views/comments/show.php'; exit; } if ($method == 'DELETE') { // Get form data parse_str($_SERVER['QUERY_STRING'], $post_vars); if (isset($post_vars['cid'])) { $comment_id = $post_vars['cid']; $comments = new CommentService(); $comment = $comments->get_comment($comment_id); // Check existence if (!isset($comment)) { HttpService::return_not_found(); } // Check permission if (!AuthenticationService::can_delete_comment($comment)) { HttpService::return_unauthorized(); } // Delete article $comments->delete_comment($comment_id); HttpService::return_no_content(); } HttpService::return_bad_request(); }
<?php /** * 根据id 查询出具体的视频直播信息 */ require_once "../config.php"; require_once ykfile("source/video_live_service.php"); require_once ykfile("source/comment_service.php"); session_start(); $id = $_GET['id']; $videoSer = new VideoLiveService(); // 因为只有这个地方需要评论的类容 所以将评论的类容集成在这个地方 $video = $videoSer->get_by_id($id); // 修改点击数量 $videoSer->update_pv($video->pv, $id); $commSer = new CommentService(); $comments = $commSer->get_comment_by_vid($video->id); $video->comments = $comments; // 该视频直播用户在我们这个平台上总共直播视频的数量 //$num = $videoSer->get_num($video->user->uuid); include_once ykfile("pages/video/detail.php");
$articles->remove_article($id); HttpService::return_no_content(); } HttpService::return_bad_request(); } // GET - Show form if ($method == "GET") { if (!isset($_GET['id'])) { HttpService::return_bad_request(); } $id = $_GET['id']; $srv = ArticleService::get_instance(); $article = $srv->get_article($id); if (!isset($article)) { HttpService::return_not_found(); } $article_id = $article->get_id(); $title = $article->get_title(); $keywords = $article->get_keywords(); $author = $article->get_author(); $content = BulletBoardCodeParser::convertToHtml($article->get_text()); $creation_date = date('F d, Y', $article->get_creation_date()); $commentsSrv = new CommentService(); $comments = $commentsSrv->get_comments_from_article($article_id); $page_title = "Article {$id}"; $page_content = '../../app/views/articles/details.php'; include_once '../../app/views/_layout.php'; exit; } // Otherwise HttpService::return_not_found();
/** * Adds and saves a comment. * @param $comment * @param bool $forceSave * @return bool */ public function addComment($comment, $forceSave = false) { if ($forceSave) { $this->save(); } if (empty($this->getId())) { return false; } $commentService = CommentService::getCommentService($this->getCommunicationService()); $commentObject = $commentService->create($this->getId()); $commentObject->setComment($comment); return $commentObject->save(); }
<?php require_once "config.php"; require_once ykfile("source/comment_service.php"); session_start(); header("Content-Type:text/html;charset=UTF-8"); $next_id = intval($_GET['next_id']); $count = intval($_GET['count']); $act_id = intval($_GET['act_id']); $commSer = new CommentService(); $comments = $commSer->get_comments($act_id, $next_id, $count); $page_title = "演讲评论"; include ykfile("pages/commentList.php");
<?php require_once "../config.php"; require_once ykfile("source/talk_service.php"); require_once ykfile("source/comment_service.php"); /** * 演讲详情页 */ $talk_id = intval($_GET['id']); $talkService = new TalkService(); $talk = $talkService->get_by_id($talk_id); $page_title = "演讲详情"; $comsrv = new CommentService(); $comments = $comsrv->get_comments($talk_id, 0, 3); require_once ykfile("pages/talk/detail.php");