Commit 2d65771cb23d38ba600786c8a4a4a08cdb537d3e
1 parent
7bfe0d47
[留言板]发表留言评论
Showing
1 changed file
with
42 additions
and
0 deletions
trunk/Message/Api/Controller/Comment/CommentController.class.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +namespace Api\Controller\Comment; | ||
4 | + | ||
5 | +use Api\Controller\AbstractController; | ||
6 | +use Common\Model\CommentModel; | ||
7 | + | ||
8 | +class CommentController extends AbstractController | ||
9 | +{ | ||
10 | + /** | ||
11 | + * 发布评论 | ||
12 | + * @author <362431947@qq.com> | ||
13 | + * @date 2018-10-10 | ||
14 | + */ | ||
15 | + public function add() | ||
16 | + { | ||
17 | + $input = I('post.'); | ||
18 | + | ||
19 | + $comment = $input['comment']; | ||
20 | + if (!$comment) { | ||
21 | + E('_ERROR_COMMENT_EMPTY'); | ||
22 | + } | ||
23 | + | ||
24 | + $uid = $input['uid']; // 评论用户 | ||
25 | + if(! $uid){ | ||
26 | + E('_ERROR_USER_ID_EMPTY'); | ||
27 | + } | ||
28 | + | ||
29 | + // 留言id | ||
30 | + $message_id = $input['message_id']; | ||
31 | + if(! $message_id){ | ||
32 | + E('_ERROR_MESSAGE_ID_EMPTY'); | ||
33 | + } | ||
34 | + | ||
35 | + $m_comment = new CommentModel(); | ||
36 | + | ||
37 | + print_r($input); | ||
38 | + $result = $m_comment->addOne($input); | ||
39 | + | ||
40 | + $this->_result = boolval($result); | ||
41 | + } | ||
42 | +} |