TopController.class.php
819 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
<?php
/**
* 【活动中心-管理端】评论置顶接口
* User: yingcai
* Date: 2017/11/28
* Time: 下午4:41
*/
namespace Apicp\Controller\Comment;
use Common\Service\CommentService;
class TopController extends AbstractController
{
public function Index_post()
{
$comment_id = I('post.comment_id', 0, 'intval');
// 评论ID不能为空
if (empty($comment_id)) {
E('_ERR_COMMENT_ID_EMPTY');
}
$comment_service = new CommentService();
$comment = $comment_service->get($comment_id);
// 评论的回复不能被置顶
if ($comment['parent_id']) {
E('_ERR_REPLY_NOT_TOP');
}
// 置顶操作
$comment_service->update($comment_id, ['top_time' => MILLI_TIME]);
return true;
}
}