/** * add comment */ public function add() { if ($this->isPost()) { $uid = $this->user['uid']; if (empty($uid)) { Message::showError('please login'); } $content = trim($_POST['content']); if (empty($content)) { Message::showError('content is empty'); } if (!is_numeric($_POST['order_id']) || !is_numeric($_POST['item_id']) || !is_numeric($_POST['star']) || !is_numeric($_POST['parent_id'])) { Message::showError('parameters is not number'); } $order_id = trim($_POST['order_id']); $item_id = trim($_POST['item_id']); $star = trim($_POST['star']); $parent_id = trim($_POST['parent_id']); $commentModel = new CommentModel(); $result = $commentModel->add($uid, $content, $star, $order_id, $item_id, $parent_id); if (!empty($result)) { Message::showSucc('add comment success'); } else { Message::showError('add comment failed'); } } $this->display('comment.html'); }