CommentListController.class.php
1.43 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
/**
* CommentListController.class.php
* 话题评论列表
* User: 代军
* Date: 2018年6月28日
*/
namespace Apicp\Controller\Topic;
use Common\Service\CircleService;
use Common\Service\LikeService;
class CommentListController extends AbstractController
{
/**
* @var LikeService 点赞信息表
*/
protected $_like_serv;
/**
* @var CircleService 同事圈信息表
*/
protected $_circle_serv;
public function before_action($action = '')
{
if (!parent::before_action($action)) {
return false;
}
// 实例化点赞信息表
$this->_like_serv = new LikeService();
// 实例化同事圈信息表
$this->_circle_serv = new CircleService();
return true;
}
public function Index_post()
{
// 接收参数
$params = I('post.');
// 参数验证
if (empty($params['id'])) {
$this->_set_error('_EMPTY_ID');
return false;
}
// 参数验证 数据表字段audit_state状态值为0,1,2
if (!is_numeric($params['audit_state']) || intval($params['audit_state'] > CircleService::AUDIT_NO)) {
$this->_set_error('_EMPTY_AUDITSTATE');
return false;
}
// 获取评论列表
$list = $this->_circle_serv->get_topic_comment_admin_list($params);
$this->_result = $list;
return true;
}
}