Commit 7bffbde81bd1a169dfa3aaa27ef0a912c550aa54
1 parent
69d2cd21
[留言板]手机端评论添加优化
Showing
3 changed files
with
0 additions
and
156 deletions
trunk/Message/Api/Controller/Comment/CommentController.class.php deleted
100644 → 0
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 | - | |
38 | - $result = $m_comment->add($input); | |
39 | - | |
40 | - $this->_result = boolval($result); | |
41 | - } | |
42 | -} |
trunk/Message/Api/Controller/Message/MsgController.class.php deleted
100644 → 0
1 | -<?php | |
2 | - | |
3 | -namespace Api\Controller\Message; | |
4 | - | |
5 | -use Api\Controller\AbstractController; | |
6 | -use Common\Model\MessageModel; | |
7 | -use Common\Model\AttachmentModel; | |
8 | - | |
9 | -class MsgController extends AbstractController | |
10 | -{ | |
11 | - | |
12 | - /** | |
13 | - * 发布留言 | |
14 | - * @author <362431947@qq.com> | |
15 | - * @date 2018-10-09 | |
16 | - */ | |
17 | - public function Index_post() | |
18 | - { | |
19 | - $input = I('post.'); | |
20 | - | |
21 | - if (! $input) { | |
22 | - E('_ERR_POST_EMPTY'); | |
23 | - } | |
24 | - | |
25 | - $title = $input['title']; | |
26 | - if (! $title) { | |
27 | - E('_ERROR_TITLE_EMPTY'); | |
28 | - } | |
29 | - | |
30 | - if (get_str_len($title) > 80) { | |
31 | - E('_ERROR_MESSAGE_TITLE_LENGTH'); | |
32 | - } | |
33 | - | |
34 | - $message = $input['message']; | |
35 | - if (! $message) { | |
36 | - E('_ERROR_MESSAGE_EMPTY'); | |
37 | - } | |
38 | - | |
39 | - if (get_str_len($message) > 500) { | |
40 | - E('_ERROR_MESSAGE_LENGTH'); | |
41 | - } | |
42 | - | |
43 | - $input['ip'] = $_SERVER['REMOTE_ADDR']; | |
44 | - | |
45 | - | |
46 | - $uid = $input['uid']; | |
47 | - if (! $uid) { | |
48 | - E('_ERROR_USER_ID_EMPTY'); | |
49 | - } | |
50 | - | |
51 | - $m_attachment = new AttachmentModel(); | |
52 | - $attach_id_str = $m_attachment->add(); | |
53 | - | |
54 | - if (false !== $attach_id_str) { | |
55 | - $input['attachment'] = $attach_id_str; | |
56 | - } | |
57 | - | |
58 | - // 素材id,多个使用逗号分隔 | |
59 | - // $input['receiver_uid'] = ''; // 不能是自己 | |
60 | - $input['domain'] = md5($_SERVER['HTTP_HOST']); | |
61 | - | |
62 | - | |
63 | - $m_message = new MessageModel(); | |
64 | - $result = $m_message->addOne($input); | |
65 | - | |
66 | - $this->_result = boolval($result); | |
67 | - } | |
68 | - | |
69 | - /** | |
70 | - * 留言列表 | |
71 | - * @author <362431947@qq.com> | |
72 | - * @date 2018-10-10 | |
73 | - */ | |
74 | - public function list_post() | |
75 | - { | |
76 | - $input = I('post.'); | |
77 | - | |
78 | - $uid = $input['uid']; | |
79 | - if (! $uid ) E('_ERROR_USER_ID_EMPTY'); | |
80 | - | |
81 | - $m_message = new MessageModel(); | |
82 | - | |
83 | - $message_list = $m_message->messageList($uid); | |
84 | - | |
85 | - $this->_result = $message_list; | |
86 | - } | |
87 | - | |
88 | -} |
trunk/Message/Common/Model/MsgCommentModel.class.php deleted
100644 → 0
1 | -<?php | |
2 | -namespace Common\Model; | |
3 | - | |
4 | -class MsgCommentModel extends AbstractModel | |
5 | -{ | |
6 | - public function __construct() | |
7 | - { | |
8 | - parent::__construct(); | |
9 | - } | |
10 | - | |
11 | - /** | |
12 | - * 添加留言与评论关联信息 | |
13 | - * @author <362431947@qq.com> | |
14 | - * @date 2018-10-10 | |
15 | - * @param array $data | |
16 | - */ | |
17 | - public function add($data = []) | |
18 | - { | |
19 | - return $this->_m->insert($data); | |
20 | - } | |
21 | - | |
22 | - public function del($message_id = 0) | |
23 | - { | |
24 | - return $this->_m->delete($message_id); | |
25 | - } | |
26 | -} |