Exemplo n.º 1
0
 /**
  * 返回对象 ...
  * @return ItemDocArticleDbModel
  */
 public static function getInstance()
 {
     if (is_null(self::$dbModelObj) || !isset(self::$dbModelObj)) {
         self::$dbModelObj = new ItemDocArticleDbModel();
     }
     return self::$dbModelObj;
 }
Exemplo n.º 2
0
 /**
  * 获取评论列表
  */
 public function lists_comment()
 {
     $page = isset($this->param['page']) && $this->param['page'] > 0 ? $this->param['page'] : 1;
     $commentList = ItemDocCommentBusiness::getCommentListPage($page);
     $pageNav = $commentList['page_nav'];
     $commentList = $commentList['data'];
     $articleIdList = "";
     foreach ($commentList as $comment) {
         $articleIdList .= "`id` = '" . $comment['id'] . "' OR ";
     }
     $articleIdList = substr($articleIdList, 0, -4);
     $articleList = ItemDocArticleBusiness::getListByWhere($articleIdList);
     $articleList = Func::arrayKey($articleList);
     foreach ($commentList as &$comment) {
         if (isset($articleList[$comment['aid']])) {
             $comment['article_name'] = $articleList[$comment['aid']]['title'];
         }
     }
     View::assign('commentList', $commentList);
     View::assign('pageNav', $pageNav);
     View::showAdminTpl('article_comment_list');
 }
Exemplo n.º 3
0
Arquivo: doc.php Projeto: web5/LX_Blog
 /**
  * Description: 评分
  */
 public function score()
 {
     $articleId = Request::getRequest('article_id', 'int', 58);
     $item = Request::getRequest('item', 'str');
     $score = Request::getRequest('score', 'int', 1);
     //判断参数
     if ($score != 1 && $score != 2 || empty($item)) {
         View::showErrorMessage(ITEM_DOMAIN, '非法操作');
     }
     //返回
     $data = array();
     //判断是否24小时内已经投过了。cookie判断,伪验证。
     $addScore = Request::getCookie('add_score');
     if (!empty($addScore) && $addScore - time() <= 86400) {
         $data['status'] = -2;
         $data['msg'] = '<p class="text-center">说你呢-.-</p><p class="text-center">不要贪得无厌哦</p><p class="text-center">24小时内只能顶一次';
         return json_encode($data);
     }
     Response::setCookie('add_score', time(), time() + 86400);
     //更新数据库
     if ($score == 1) {
         $result = ItemDocArticleBusiness::goodNum($articleId);
     } else {
         if ($score == 2) {
             $result = ItemDocArticleBusiness::badNum($articleId);
         }
     }
     //整理返回值
     if ($result) {
         $data['status'] = 0;
         $data['msg'] = 1;
     } else {
         $data['status'] = -1;
         $data['msg'] = '不明所以的失败了,请重新。';
     }
     return json_encode($data);
 }