CommentController.class.php
862 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
<?php
namespace Api\Controller\Comment;
use Api\Controller\AbstractController;
use Common\Model\CommentModel;
class CommentController extends AbstractController
{
/**
* 发布评论
* @author <362431947@qq.com>
* @date 2018-10-10
*/
public function add()
{
$input = I('post.');
$comment = $input['comment'];
if (!$comment) {
E('_ERROR_COMMENT_EMPTY');
}
$uid = $input['uid']; // 评论用户
if(! $uid){
E('_ERROR_USER_ID_EMPTY');
}
// 留言id
$message_id = $input['message_id'];
if(! $message_id){
E('_ERROR_MESSAGE_ID_EMPTY');
}
$m_comment = new CommentModel();
print_r($input);
$result = $m_comment->addOne($input);
$this->_result = boolval($result);
}
}