/** * 评论 */ public function add() { $data['object_id'] = (int) Request::input('objectid'); $data['object_type'] = (int) Request::input('object_type'); $data['nickname'] = strip_tags(Request::input('nickname')); $data['content'] = strip_tags(Request::input('comment')); $data['replyid'] = (int) Request::input('replyid'); $commentProcess = new CommentProcess(); if ($commentProcess->addComment($data) !== false) { return response(Js::execute('window.parent.reloadComment();')); } return response(Js::error($commentProcess->getErrorMessage())); }
/** * 回复评论 */ private function commentReply() { $data['object_id'] = (int) Request::input('objectid'); $data['object_type'] = (int) Request::input('object_type'); $data['nickname'] = strip_tags(Request::input('nickname')); $data['content'] = strip_tags(Request::input('comment')); $data['replyid'] = (int) Request::input('replyid'); $insertId = $this->commentProcess->addComment($data); if ($insertId !== false) { $this->setActionLog(['replyid' => $data['replyid'], 'object_id' => $data['object_id'], 'content' => $data['content']]); return Js::execute('window.parent.loadComment(' . $insertId . ');'); } return Js::error($this->commentProcess->getErrorMessage()) . Js::execute('window.parent.reloadDialogTitle();'); }