ChildListController.class.php
1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
/**
* 查询子评论列表接口
* 鲜彤 2016年09月02日
*/
namespace Apicp\Controller\Comment;
use Common\Common\Comment;
class ChildListController extends AbstractController
{
public function Index()
{
// 接收数据
$rootId = I('post.rootId'); // 顶级评论id
$cmtObjid = I('post.cmtObjid'); // 评论对象ID 注:此处为由前端接收的'评论对象id',发送UC时需要进行处理
$page = I('post.page'); // 当前页码
$perpage = I('post.limit'); // 每页条数
// 评论对象id不能为空
if (! $cmtObjid) {
$this->_set_error("_ERR_EMPTY_CMTOBJ_ID");
return false;
}
// 组织查询条件
$condition = array(
"rootId" => $rootId,
"cmtObjid" => $cmtObjid
);
// 实例化sdk,搜索评论列表
$result = Comment::instance()->listChild($condition, $page, $perpage);
// 返回数据
$this->_result = array(
"page" => $result['pageNum'],
"limit" => $result['pageSize'],
"total" => $result['total'],
"list" => $result['list']
);
return true;
}
}