DelController.class.php
1012 Bytes
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
<?php
/**
* 删除我的评论接口
* User: daijun
* Date: 2017-05-08
*/
namespace Api\Controller\Comment;
use Common\Service\CommentService;
class DelController extends AbstractController
{
/**
* @var CommentService 评论回复信息表
*/
protected $_comment_serv;
public function before_action($action = '')
{
if (!parent::before_action($action)) {
return false;
}
$this->_comment_serv = new CommentService();
return true;
}
public function Index_post()
{
// 获取参数
$comment_id = I('post.comment_id', 0, 'intval');
// 验证参数
if (empty($comment_id)) {
E('_EMPTY_COMMENT_ID');
}
// uid不能为空
if (!$this->uid) {
E('_EMPTY_UID');
}
// 执行删除
if (!$this->_comment_serv->del_comment($comment_id, $this->uid)) {
E('_ERR_DEL_FAIL');
}
return true;
}
}