AddController.class.php
878 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
<?php
namespace Api\Controller\Comment;
use Api\Controller\AbstractController;
use Common\Model\CommentModel;
class AddController extends AbstractController
{
/**
* 发布评论
* @author <362431947@qq.com>
* @date 2018-10-10
*/
public function Index_post()
{
$input = I('post.');
$comment = $input['comment'];
if (!$comment) {
E('_ERROR_COMMENT_EMPTY');
}
if (get_str_len($comment) > 140) {
E('_ERROR_COMMENT_LENGTH');
}
$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();
$m_comment->add($input);
}
}