/** * @todo: 发送评论 * @author Saki <*****@*****.**> * @date 2014-12-22 上午9:34:18 * @version V1.0 */ public function PostComment() { $model = new \Admin\Model\ArticleCommentModel(); $post = $_POST['ArticleComment']; $id = $post['aid']; $comment_id = $model->createComment($post); //发送邮件,这里为游客发送评论,则为管理员邮箱收到邮件 if ($comment_id) { \Think\Hook::listen('postComment', $comment_id); \Think\Hook::add('postComment', 'Home\\Behaviors\\emailBehavior'); } $this->redirect('Article/view', array('id' => $id, 'p' => 1)); }
/** * @todo: 发送评论-后台管理员发送 * @author Saki <*****@*****.**> * @date 2014-12-22 上午9:34:18 * @version V1.0 */ public function PostComment() { $model = new \Admin\Model\ArticleCommentModel(); $post = $_POST['ArticleComment']; $id = $post['aid']; $admin_info = $this->admin_info; $post['is_admin'] = $admin_info['id']; $comment_id = $model->createComment($post); if ($comment_id) { \Think\Hook::listen('postComment', $comment_id); \Think\Hook::add('postComment', 'Home\\Behaviors\\emailBehavior'); } $this->redirect('ArticleList/view', array('id' => $id, 'p' => 1)); }