Пример #1
0
 public function diggDocument($document_id)
 {
     $this->requireLogin();
     //调用赞插件增加赞数量
     $addon = new DiggAddon();
     $digg_count = $addon->vote($this->getUid(), $document_id);
     if ($digg_count === false) {
         $this->apiError(2101, "您已经赞过,不能重复赞");
     }
     //返回成功消息
     $this->apiSuccess("操作成功", null, array('digg_count' => $digg_count));
 }
Пример #2
0
 protected function getTopicStructure($document_id, $comment_count)
 {
     $document = D('Home/Document')->where(array('id' => $document_id, 'status' => 1))->find();
     $e = $document;
     //添加文档编号
     $e['document_id'] = $e['id'];
     //添加主题内容
     $model_name = D('Admin/Model')->where(array('id' => $e['model_id'], 'status' => 1))->find();
     $model_name = $model_name['name'];
     if ($model_name == 'weibo') {
         $detail = D('Home/Document')->detail($e['id']);
         $e['content'] = $detail['content'];
     } else {
         $e['content'] = '';
     }
     //添加用户信息
     $e['user'] = $this->getAuthorStructure($e['uid']);
     //添加评论信息
     $e['comment_count'] = $e['comment'];
     $e['comment'] = $this->getCommentList($e['document_id'], 0, $comment_count);
     //添加赞数量
     $addon = new DiggAddon();
     $digg_count = $addon->getDiggCount($document_id);
     $e['digg_count'] = $digg_count;
     //筛选需要的字段
     $e = array('document_id' => $e['document_id'], 'title' => $e['title'], 'user' => $e['user'], 'type' => $model_name, 'content' => $e['content'], 'create_time' => $e['create_time'], 'update_time' => $e['update_time'], 'view_count' => strval(intval($e['view'])), 'comment_count' => strval(intval($e['comment_count'])), 'digg_count' => strval(intval($e['digg_count'])), 'comment' => $e['comment']);
     //返回结果
     return $e;
 }
Пример #3
0
 protected function getTopicStructure($art_id, $comment_count)
 {
     $e = D('Home/Article')->where(array('id' => $art_id, 'status' => 1))->find();
     //添加用户信息
     $e['user'] = $this->getAuthorStructure($e['uid']);
     //添加评论信息
     $e['comment_count'] = $e['comment'];
     $e['comment'] = $this->getCommentList($e['document_id'], 0, $comment_count);
     //添加赞数量
     $addon = new DiggAddon();
     $digg_count = $addon->getDiggCount($document_id);
     $e['digg_count'] = $digg_count;
     //筛选需要的字段
     $e = array('document_id' => $e['document_id'], 'title' => $e['title'], 'user' => $e['user'], 'type' => $model_name, 'content' => $e['content'], 'create_time' => $e['create_time'], 'update_time' => $e['update_time'], 'view_count' => strval(intval($e['view'])), 'comment_count' => strval(intval($e['comment_count'])), 'digg_count' => strval(intval($e['digg_count'])), 'comment' => $e['comment']);
     //返回结果
     return $e;
 }