<?php namespace app\admin\controller\article; use app\admin\controller\BaseAdminController; use app\admin\lists\article\ArticleCommentLists; use app\admin\logic\article\ArticleCommentLogic; use app\admin\validate\article\ArticleCommentValidate; /** * 评论控制器 * Class ArticleCommentController * @package app\admin\controller\article */ class ArticleCommentController extends BaseAdminController { /** * @notes 获取评论列表 * @return \think\response\Json * @author likeadmin * @date 2024/02/18 15:03 */ public function lists() { return $this->dataLists(new ArticleCommentLists()); } /** * @notes 添加评论 * @return \think\response\Json * @author likeadmin * @date 2024/02/18 15:03 */ public function add() { $params = (new ArticleCommentValidate())->post()->goCheck('add'); $result = ArticleCommentLogic::add($params); if (true === $result) { return $this->success('添加成功', [], 1, 1); } return $this->fail(ArticleCommentLogic::getError()); } /** * @notes 编辑评论 * @return \think\response\Json * @author likeadmin * @date 2024/02/18 15:03 */ public function edit() { $params = (new ArticleCommentValidate())->post()->goCheck('edit'); $result = ArticleCommentLogic::edit($params); if (true === $result) { return $this->success('编辑成功', [], 1, 1); } return $this->fail(ArticleCommentLogic::getError()); } /** * @notes 删除评论 * @return \think\response\Json * @author likeadmin * @date 2024/02/18 15:03 */ public function delete() { $params = (new ArticleCommentValidate())->post()->goCheck('delete'); ArticleCommentLogic::delete($params); return $this->success('删除成功', [], 1, 1); } /** * @notes 获取评论详情 * @return \think\response\Json * @author likeadmin * @date 2024/02/18 15:03 */ public function detail() { $params = (new ArticleCommentValidate())->goCheck('detail'); $result = ArticleCommentLogic::detail($params); return $this->data($result); } }