Commit adaa2f8129edf4b3e928e0bedc58018ffa3f69c5

Authored by zhang
1 parent 03233713

[留言板]评论

trunk/Message/Api/Controller/Comment/AddController.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 AddController extends AbstractController
  9 +{
  10 + /**
  11 + * 发布评论
  12 + * @author <362431947@qq.com>
  13 + * @date 2018-10-10
  14 + */
  15 + public function Index_post()
  16 + {
  17 + $input = I('post.');
  18 +
  19 + $comment = $input['comment'];
  20 + if (!$comment) {
  21 + E('_ERROR_COMMENT_EMPTY');
  22 + }
  23 +
  24 + if (get_str_len($comment) > 140) {
  25 + E('_ERROR_COMMENT_LENGTH');
  26 + }
  27 +
  28 + $uid = $input['uid']; // 评论用户
  29 + if(! $uid){
  30 + E('_ERROR_USER_ID_EMPTY');
  31 + }
  32 +
  33 + // 留言id
  34 + $message_id = $input['message_id'];
  35 + if(! $message_id){
  36 + E('_ERROR_MESSAGE_ID_EMPTY');
  37 + }
  38 +
  39 + $m_comment = new CommentModel();
  40 +
  41 +
  42 + $m_comment->add($input);
  43 + }
  44 +}
trunk/Message/Apicp/Controller/Message/MessageController.class.php deleted 100644 → 0
1 -<?php  
2 -  
3 -namespace Apicp\Controller\Message;  
4 -  
5 -use Apicp\Controller\AbstractController;  
6 -use Common\Model\MessageModel;  
7 -  
8 -class MessageController extends AbstractController  
9 -{  
10 - protected $_require_login = false;  
11 -  
12 - private $m_message;  
13 - // MessageModel 模型对象  
14 -  
15 - public function __construct()  
16 - {  
17 - parent::__construct();  
18 -  
19 - $this->m_message = new MessageModel;  
20 - }  
21 -  
22 - /**  
23 - * 留言删除  
24 - * @author <362431947@qq.com>  
25 - * @date 2018-10-10  
26 - */  
27 - public function del_post()  
28 - {  
29 - $input = I('post.');  
30 -  
31 - $message_id = intval($input['message_id']);  
32 - if(! $message_id){  
33 - E('_ERROR_MESSAGE_ID_EMPTY');  
34 - }  
35 -  
36 -  
37 - $result = $this->m_message->del($message_id);  
38 -  
39 - $this->_result = boolval($result);  
40 - }  
41 -  
42 - /**  
43 - * 搜索 搜索(按姓名、性别、手机号、邮箱以及留言标题进行或查询)、列表、留言详情查看  
44 - * User: <362431947@qq.com>  
45 - * @return bool  
46 - * @throws \Think\Exception  
47 - * Date: 2018-10-10 Time: 9:31  
48 - */  
49 - public function search_post()  
50 - {  
51 - $input = I('post.');  
52 -  
53 -// print_r($input);  
54 -  
55 - $conds = $input;  
56 -// $conds = $this->getConds($input);  
57 -  
58 -  
59 - if (false === $conds) {  
60 - E('_ERROR_SEARCH_CONDS_EMPTY');  
61 - }  
62 -  
63 - $list = $this->m_message->search($conds);  
64 -  
65 -  
66 - $this->_result = $list;  
67 -  
68 - return true;  
69 - }  
70 -  
71 - /**  
72 - * 留言信息列表  
73 - * User: <362431947@qq.com>  
74 - * Date: 2018-10-11 Time: 9:58  
75 - */  
76 - public function list_post()  
77 - {  
78 - $input = I('post.');  
79 -  
80 - $page = intval($input['page']);  
81 -  
82 - unset($input['page']);  
83 -  
84 -  
85 - $this->_result = $this->m_message->messageList($input,$page);  
86 - }  
87 -  
88 - /**  
89 - * 留言详情  
90 - * User: <362431947@qq.com>  
91 - * Date: 2018-10-11 Time: 11:51  
92 - */  
93 - public function detail_post()  
94 - {  
95 - $input = I('post.');  
96 -  
97 - $message_id = intval($input['message_id']);  
98 -  
99 - $this->_result = $this->m_message->messageDetail($message_id);  
100 - }  
101 -  
102 - /**  
103 - * 获取搜索条件  
104 - * User: <362431947@qq.com>  
105 - * @param array $search  
106 - * @return array|bool  
107 - * Date: 2018-10-10  
108 - */  
109 - private function getConds($search = [])  
110 - {  
111 - if (! $search) {  
112 - return false;  
113 - }  
114 -  
115 - $conds = [];  
116 - $fields = ['name','sex','mobile','email','title'];  
117 -  
118 - foreach ($fields as $field) {  
119 - if ($val = trim($search[$field])) {  
120 - $conds[$field] = $val;  
121 - break;  
122 - }  
123 - }  
124 - print_r($conds);  
125 - return $conds;  
126 - }  
127 -}  
trunk/Message/Common/Model/CommentModel.class.php
@@ -46,7 +46,7 @@ class CommentModel extends AbstractModel @@ -46,7 +46,7 @@ class CommentModel extends AbstractModel
46 $m_person = new PersonModel(); 46 $m_person = new PersonModel();
47 $table_person = $m_person->get_tname(); 47 $table_person = $m_person->get_tname();
48 48
49 - $sql = "SELECT `comment`,b.name commenter,a.created 49 + $sql = "SELECT `comment`,IFNULL(b.name,'') commenter,a.created
50 FROM __TABLE__ a 50 FROM __TABLE__ a
51 LEFT JOIN {$table_person} b ON a.uid = b.person_id 51 LEFT JOIN {$table_person} b ON a.uid = b.person_id
52 WHERE `message_id` = ? "; 52 WHERE `message_id` = ? ";
trunk/Message/attachment/2018/10/message5bbc83c12739f1.59683518.png deleted 100644 → 0

407 Bytes

trunk/Message/attachment/2018/10/message5bbc85846896d9.81984943.png deleted 100644 → 0

407 Bytes