From f40c47ae68b85cd7a5e3fd68b064e8f1e81a635f Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Thu, 11 Apr 2024 09:44:25 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BA=AF=E5=87=80=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../article/ArticleCommentController.php | 95 ------------ .../article/ArticleCommentLikeController.php | 95 ------------ .../controller/article/ArticleController.php | 95 ------------ .../article/ArticleLabelController.php | 95 ------------ .../article/ArticleLikeController.php | 95 ------------ .../lists/article/ArticleCommentLikeLists.php | 65 -------- .../lists/article/ArticleCommentLists.php | 66 -------- app/admin/lists/article/ArticleLabelLists.php | 70 --------- app/admin/lists/article/ArticleLikeLists.php | 65 -------- app/admin/lists/article/ArticleLists.php | 65 -------- .../logic/article/ArticleCommentLikeLogic.php | 98 ------------ .../logic/article/ArticleCommentLogic.php | 95 ------------ app/admin/logic/article/ArticleLabelLogic.php | 94 ----------- app/admin/logic/article/ArticleLikeLogic.php | 98 ------------ app/admin/logic/article/ArticleLogic.php | 146 ------------------ .../article/ArticleCommentLikeValidate.php | 82 ---------- .../article/ArticleCommentValidate.php | 82 ---------- .../validate/article/ArticleLabelValidate.php | 82 ---------- .../validate/article/ArticleLikeValidate.php | 82 ---------- .../validate/article/ArticleValidate.php | 82 ---------- app/common/model/article/Article.php | 25 --- app/common/model/article/ArticleComment.php | 26 ---- .../model/article/ArticleCommentLike.php | 22 --- app/common/model/article/ArticleContent.php | 18 --- app/common/model/article/ArticleLabel.php | 22 --- app/common/model/article/ArticleLike.php | 22 --- 26 files changed, 1882 deletions(-) delete mode 100644 app/admin/controller/article/ArticleCommentController.php delete mode 100644 app/admin/controller/article/ArticleCommentLikeController.php delete mode 100644 app/admin/controller/article/ArticleController.php delete mode 100644 app/admin/controller/article/ArticleLabelController.php delete mode 100644 app/admin/controller/article/ArticleLikeController.php delete mode 100644 app/admin/lists/article/ArticleCommentLikeLists.php delete mode 100644 app/admin/lists/article/ArticleCommentLists.php delete mode 100644 app/admin/lists/article/ArticleLabelLists.php delete mode 100644 app/admin/lists/article/ArticleLikeLists.php delete mode 100644 app/admin/lists/article/ArticleLists.php delete mode 100644 app/admin/logic/article/ArticleCommentLikeLogic.php delete mode 100644 app/admin/logic/article/ArticleCommentLogic.php delete mode 100644 app/admin/logic/article/ArticleLabelLogic.php delete mode 100644 app/admin/logic/article/ArticleLikeLogic.php delete mode 100644 app/admin/logic/article/ArticleLogic.php delete mode 100644 app/admin/validate/article/ArticleCommentLikeValidate.php delete mode 100644 app/admin/validate/article/ArticleCommentValidate.php delete mode 100644 app/admin/validate/article/ArticleLabelValidate.php delete mode 100644 app/admin/validate/article/ArticleLikeValidate.php delete mode 100644 app/admin/validate/article/ArticleValidate.php delete mode 100644 app/common/model/article/Article.php delete mode 100644 app/common/model/article/ArticleComment.php delete mode 100644 app/common/model/article/ArticleCommentLike.php delete mode 100644 app/common/model/article/ArticleContent.php delete mode 100644 app/common/model/article/ArticleLabel.php delete mode 100644 app/common/model/article/ArticleLike.php diff --git a/app/admin/controller/article/ArticleCommentController.php b/app/admin/controller/article/ArticleCommentController.php deleted file mode 100644 index ea9123a..0000000 --- a/app/admin/controller/article/ArticleCommentController.php +++ /dev/null @@ -1,95 +0,0 @@ -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); - } - - -} \ No newline at end of file diff --git a/app/admin/controller/article/ArticleCommentLikeController.php b/app/admin/controller/article/ArticleCommentLikeController.php deleted file mode 100644 index 73a2672..0000000 --- a/app/admin/controller/article/ArticleCommentLikeController.php +++ /dev/null @@ -1,95 +0,0 @@ -dataLists(new ArticleCommentLikeLists()); - } - - - /** - * @notes 添加评论点赞 - * @return \think\response\Json - * @author likeadmin - * @date 2024/02/18 15:41 - */ - public function add() - { - $params = (new ArticleCommentLikeValidate())->post()->goCheck('add'); - $result = ArticleCommentLikeLogic::add($params); - if (true === $result) { - return $this->success('添加成功', [], 1, 1); - } - return $this->fail(ArticleCommentLikeLogic::getError()); - } - - - /** - * @notes 编辑评论点赞 - * @return \think\response\Json - * @author likeadmin - * @date 2024/02/18 15:41 - */ - public function edit() - { - $params = (new ArticleCommentLikeValidate())->post()->goCheck('edit'); - $result = ArticleCommentLikeLogic::edit($params); - if (true === $result) { - return $this->success('编辑成功', [], 1, 1); - } - return $this->fail(ArticleCommentLikeLogic::getError()); - } - - - /** - * @notes 删除评论点赞 - * @return \think\response\Json - * @author likeadmin - * @date 2024/02/18 15:41 - */ - public function delete() - { - $params = (new ArticleCommentLikeValidate())->post()->goCheck('delete'); - ArticleCommentLikeLogic::delete($params); - return $this->success('删除成功', [], 1, 1); - } - - - /** - * @notes 获取评论点赞详情 - * @return \think\response\Json - * @author likeadmin - * @date 2024/02/18 15:41 - */ - public function detail() - { - $params = (new ArticleCommentLikeValidate())->goCheck('detail'); - $result = ArticleCommentLikeLogic::detail($params); - return $this->data($result); - } - - -} \ No newline at end of file diff --git a/app/admin/controller/article/ArticleController.php b/app/admin/controller/article/ArticleController.php deleted file mode 100644 index d40c89f..0000000 --- a/app/admin/controller/article/ArticleController.php +++ /dev/null @@ -1,95 +0,0 @@ -dataLists(new ArticleLists()); - } - - - /** - * @notes 添加文章 - * @return \think\response\Json - * @author likeadmin - * @date 2024/02/05 16:36 - */ - public function add() - { - $params = (new ArticleValidate())->post()->goCheck('add'); - $result = ArticleLogic::add($params); - if (true === $result) { - return $this->success('添加成功', [], 1, 1); - } - return $this->fail(ArticleLogic::getError()); - } - - - /** - * @notes 编辑文章 - * @return \think\response\Json - * @author likeadmin - * @date 2024/02/05 16:36 - */ - public function edit() - { - $params = (new ArticleValidate())->post()->goCheck('edit'); - $result = ArticleLogic::edit($params); - if (true === $result) { - return $this->success('编辑成功', [], 1, 1); - } - return $this->fail(ArticleLogic::getError()); - } - - - /** - * @notes 删除文章 - * @return \think\response\Json - * @author likeadmin - * @date 2024/02/05 16:36 - */ - public function delete() - { - $params = (new ArticleValidate())->post()->goCheck('delete'); - ArticleLogic::delete($params); - return $this->success('删除成功', [], 1, 1); - } - - - /** - * @notes 获取文章详情 - * @return \think\response\Json - * @author likeadmin - * @date 2024/02/05 16:36 - */ - public function detail() - { - $params = (new ArticleValidate())->goCheck('detail'); - $result = ArticleLogic::detail($params); - return $this->data($result); - } - - -} \ No newline at end of file diff --git a/app/admin/controller/article/ArticleLabelController.php b/app/admin/controller/article/ArticleLabelController.php deleted file mode 100644 index 83a85a1..0000000 --- a/app/admin/controller/article/ArticleLabelController.php +++ /dev/null @@ -1,95 +0,0 @@ -dataLists(new ArticleLabelLists()); - } - - - /** - * @notes 添加文章标签 - * @return \think\response\Json - * @author likeadmin - * @date 2024/02/17 14:07 - */ - public function add() - { - $params = (new ArticleLabelValidate())->post()->goCheck('add'); - $result = ArticleLabelLogic::add($params); - if (true === $result) { - return $this->success('添加成功', [], 1, 1); - } - return $this->fail(ArticleLabelLogic::getError()); - } - - - /** - * @notes 编辑文章标签 - * @return \think\response\Json - * @author likeadmin - * @date 2024/02/17 14:07 - */ - public function edit() - { - $params = (new ArticleLabelValidate())->post()->goCheck('edit'); - $result = ArticleLabelLogic::edit($params); - if (true === $result) { - return $this->success('编辑成功', [], 1, 1); - } - return $this->fail(ArticleLabelLogic::getError()); - } - - - /** - * @notes 删除文章标签 - * @return \think\response\Json - * @author likeadmin - * @date 2024/02/17 14:07 - */ - public function delete() - { - $params = (new ArticleLabelValidate())->post()->goCheck('delete'); - ArticleLabelLogic::delete($params); - return $this->success('删除成功', [], 1, 1); - } - - - /** - * @notes 获取文章标签详情 - * @return \think\response\Json - * @author likeadmin - * @date 2024/02/17 14:07 - */ - public function detail() - { - $params = (new ArticleLabelValidate())->goCheck('detail'); - $result = ArticleLabelLogic::detail($params); - return $this->data($result); - } - - -} \ No newline at end of file diff --git a/app/admin/controller/article/ArticleLikeController.php b/app/admin/controller/article/ArticleLikeController.php deleted file mode 100644 index 8ab7893..0000000 --- a/app/admin/controller/article/ArticleLikeController.php +++ /dev/null @@ -1,95 +0,0 @@ -dataLists(new ArticleLikeLists()); - } - - - /** - * @notes 添加文章点赞 - * @return \think\response\Json - * @author likeadmin - * @date 2024/02/18 15:47 - */ - public function add() - { - $params = (new ArticleLikeValidate())->post()->goCheck('add'); - $result = ArticleLikeLogic::add($params); - if (true === $result) { - return $this->success('添加成功', [], 1, 1); - } - return $this->fail(ArticleLikeLogic::getError()); - } - - - /** - * @notes 编辑文章点赞 - * @return \think\response\Json - * @author likeadmin - * @date 2024/02/18 15:47 - */ - public function edit() - { - $params = (new ArticleLikeValidate())->post()->goCheck('edit'); - $result = ArticleLikeLogic::edit($params); - if (true === $result) { - return $this->success('编辑成功', [], 1, 1); - } - return $this->fail(ArticleLikeLogic::getError()); - } - - - /** - * @notes 删除文章点赞 - * @return \think\response\Json - * @author likeadmin - * @date 2024/02/18 15:47 - */ - public function delete() - { - $params = (new ArticleLikeValidate())->post()->goCheck('delete'); - ArticleLikeLogic::delete($params); - return $this->success('删除成功', [], 1, 1); - } - - - /** - * @notes 获取文章点赞详情 - * @return \think\response\Json - * @author likeadmin - * @date 2024/02/18 15:47 - */ - public function detail() - { - $params = (new ArticleLikeValidate())->goCheck('detail'); - $result = ArticleLikeLogic::detail($params); - return $this->data($result); - } - - -} \ No newline at end of file diff --git a/app/admin/lists/article/ArticleCommentLikeLists.php b/app/admin/lists/article/ArticleCommentLikeLists.php deleted file mode 100644 index 0fc4623..0000000 --- a/app/admin/lists/article/ArticleCommentLikeLists.php +++ /dev/null @@ -1,65 +0,0 @@ - ['comment_id', 'state', 'like_user'], - ]; - } - - - /** - * @notes 获取评论点赞列表 - * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException - * @author likeadmin - * @date 2024/02/18 15:41 - */ - public function lists(): array - { - return ArticleCommentLike::where($this->searchWhere) - ->field(['id', 'comment_id', 'state', 'like_user']) - ->limit($this->limitOffset, $this->limitLength) - ->order(['id' => 'desc']) - ->select() - ->toArray(); - } - - - /** - * @notes 获取评论点赞数量 - * @return int - * @author likeadmin - * @date 2024/02/18 15:41 - */ - public function count(): int - { - return ArticleCommentLike::where($this->searchWhere)->count(); - } - -} \ No newline at end of file diff --git a/app/admin/lists/article/ArticleCommentLists.php b/app/admin/lists/article/ArticleCommentLists.php deleted file mode 100644 index 06317c1..0000000 --- a/app/admin/lists/article/ArticleCommentLists.php +++ /dev/null @@ -1,66 +0,0 @@ - ['article_id', 'state', 'comment_user'], - ]; - } - - - /** - * @notes 获取评论列表 - * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException - * @author likeadmin - * @date 2024/02/18 15:03 - */ - public function lists(): array - { - return ArticleComment::where($this->searchWhere) - ->with(['title']) - ->field(['id', 'pre_id', 'content', 'article_id', 'state', 'comment_user']) - ->limit($this->limitOffset, $this->limitLength) - ->order(['id' => 'desc']) - ->select() - ->toArray(); - } - - - /** - * @notes 获取评论数量 - * @return int - * @author likeadmin - * @date 2024/02/18 15:03 - */ - public function count(): int - { - return ArticleComment::where($this->searchWhere)->count(); - } - -} \ No newline at end of file diff --git a/app/admin/lists/article/ArticleLabelLists.php b/app/admin/lists/article/ArticleLabelLists.php deleted file mode 100644 index dcd64bf..0000000 --- a/app/admin/lists/article/ArticleLabelLists.php +++ /dev/null @@ -1,70 +0,0 @@ - ['article_id', 'label_id'], - ]; - } - - - /** - * @notes 获取文章标签列表 - * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException - * @author likeadmin - * @date 2024/02/17 14:07 - */ - public function lists(): array - { - return ArticleLabel::where($this->searchWhere) - ->field(['id', 'article_id', 'label_id']) - ->limit($this->limitOffset, $this->limitLength) - ->order(['id' => 'desc']) - ->select() - ->each(function($item){ - $item['article_id']=Article::where('id',$item['article_id'])->value('title'); - $item['label_id']=Label::where('id',$item['label_id'])->value('label_name'); - }) - ->toArray(); - } - - - /** - * @notes 获取文章标签数量 - * @return int - * @author likeadmin - * @date 2024/02/17 14:07 - */ - public function count(): int - { - return ArticleLabel::where($this->searchWhere)->count(); - } - -} \ No newline at end of file diff --git a/app/admin/lists/article/ArticleLikeLists.php b/app/admin/lists/article/ArticleLikeLists.php deleted file mode 100644 index fd0efe4..0000000 --- a/app/admin/lists/article/ArticleLikeLists.php +++ /dev/null @@ -1,65 +0,0 @@ - ['article_id', 'state', 'like_user'], - ]; - } - - - /** - * @notes 获取文章点赞列表 - * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException - * @author likeadmin - * @date 2024/02/18 15:47 - */ - public function lists(): array - { - return ArticleLike::where($this->searchWhere) - ->field(['id', 'article_id', 'state', 'like_user']) - ->limit($this->limitOffset, $this->limitLength) - ->order(['id' => 'desc']) - ->select() - ->toArray(); - } - - - /** - * @notes 获取文章点赞数量 - * @return int - * @author likeadmin - * @date 2024/02/18 15:47 - */ - public function count(): int - { - return ArticleLike::where($this->searchWhere)->count(); - } - -} \ No newline at end of file diff --git a/app/admin/lists/article/ArticleLists.php b/app/admin/lists/article/ArticleLists.php deleted file mode 100644 index 278bcc5..0000000 --- a/app/admin/lists/article/ArticleLists.php +++ /dev/null @@ -1,65 +0,0 @@ - ['title', 'state'], - ]; - } - - - /** - * @notes 获取文章列表 - * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException - * @author likeadmin - * @date 2024/02/05 16:36 - */ - public function lists(): array - { - return Article::where($this->searchWhere) - ->field(['id', 'title_map', 'title', 'state', 'pv', 'top', 'create_user', 'update_user']) - ->limit($this->limitOffset, $this->limitLength) - ->order(['id' => 'desc']) - ->select() - ->toArray(); - } - - - /** - * @notes 获取文章数量 - * @return int - * @author likeadmin - * @date 2024/02/05 16:36 - */ - public function count(): int - { - return Article::where($this->searchWhere)->count(); - } - -} \ No newline at end of file diff --git a/app/admin/logic/article/ArticleCommentLikeLogic.php b/app/admin/logic/article/ArticleCommentLikeLogic.php deleted file mode 100644 index 602531f..0000000 --- a/app/admin/logic/article/ArticleCommentLikeLogic.php +++ /dev/null @@ -1,98 +0,0 @@ - $params['comment_id'], - 'state' => $params['state'], - 'like_user' => $params['like_user'] - ]); - - Db::commit(); - return true; - } catch (\Exception $e) { - Db::rollback(); - self::setError($e->getMessage()); - return false; - } - } - - - /** - * @notes 编辑评论点赞 - * @param array $params - * @return bool - * @author likeadmin - * @date 2024/02/18 15:41 - */ - public static function edit(array $params): bool - { - Db::startTrans(); - try { - ArticleCommentLike::where('id', $params['id'])->update([ - 'comment_id' => $params['comment_id'], - 'state' => $params['state'], - 'like_user' => $params['like_user'] - ]); - - Db::commit(); - return true; - } catch (\Exception $e) { - Db::rollback(); - self::setError($e->getMessage()); - return false; - } - } - - - /** - * @notes 删除评论点赞 - * @param array $params - * @return bool - * @author likeadmin - * @date 2024/02/18 15:41 - */ - public static function delete(array $params): bool - { - return ArticleCommentLike::destroy($params['id']); - } - - - /** - * @notes 获取评论点赞详情 - * @param $params - * @return array - * @author likeadmin - * @date 2024/02/18 15:41 - */ - public static function detail($params): array - { - return ArticleCommentLike::findOrEmpty($params['id'])->toArray(); - } -} \ No newline at end of file diff --git a/app/admin/logic/article/ArticleCommentLogic.php b/app/admin/logic/article/ArticleCommentLogic.php deleted file mode 100644 index fff84a6..0000000 --- a/app/admin/logic/article/ArticleCommentLogic.php +++ /dev/null @@ -1,95 +0,0 @@ -getMessage()); - return false; - } - } - - - /** - * @notes 编辑评论 - * @param array $params - * @return bool - * @author likeadmin - * @date 2024/02/18 15:03 - */ - public static function edit(array $params): bool - { - Db::startTrans(); - try { - ArticleComment::where('id', $params['id'])->update([ - 'content' => $params['content'], - 'state' => $params['state'] - ]); - - Db::commit(); - return true; - } catch (\Exception $e) { - Db::rollback(); - self::setError($e->getMessage()); - return false; - } - } - - - /** - * @notes 删除评论 - * @param array $params - * @return bool - * @author likeadmin - * @date 2024/02/18 15:03 - */ - public static function delete(array $params): bool - { - return ArticleComment::destroy($params['id']); - } - - - /** - * @notes 获取评论详情 - * @param $params - * @return array - * @author likeadmin - * @date 2024/02/18 15:03 - */ - public static function detail($params): array - { - return ArticleComment::findOrEmpty($params['id'])->toArray(); - } -} \ No newline at end of file diff --git a/app/admin/logic/article/ArticleLabelLogic.php b/app/admin/logic/article/ArticleLabelLogic.php deleted file mode 100644 index 0704dd7..0000000 --- a/app/admin/logic/article/ArticleLabelLogic.php +++ /dev/null @@ -1,94 +0,0 @@ -getMessage()); - return false; - } - } - - - /** - * @notes 编辑文章标签 - * @param array $params - * @return bool - * @author likeadmin - * @date 2024/02/17 14:07 - */ - public static function edit(array $params): bool - { - Db::startTrans(); - try { - ArticleLabel::where('id', $params['id'])->update([ - - ]); - - Db::commit(); - return true; - } catch (\Exception $e) { - Db::rollback(); - self::setError($e->getMessage()); - return false; - } - } - - - /** - * @notes 删除文章标签 - * @param array $params - * @return bool - * @author likeadmin - * @date 2024/02/17 14:07 - */ - public static function delete(array $params): bool - { - return ArticleLabel::destroy($params['id']); - } - - - /** - * @notes 获取文章标签详情 - * @param $params - * @return array - * @author likeadmin - * @date 2024/02/17 14:07 - */ - public static function detail($params): array - { - return ArticleLabel::findOrEmpty($params['id'])->toArray(); - } -} \ No newline at end of file diff --git a/app/admin/logic/article/ArticleLikeLogic.php b/app/admin/logic/article/ArticleLikeLogic.php deleted file mode 100644 index 492db45..0000000 --- a/app/admin/logic/article/ArticleLikeLogic.php +++ /dev/null @@ -1,98 +0,0 @@ - $params['article_id'], - 'state' => $params['state'], - 'like_user' => $params['like_user'] - ]); - - Db::commit(); - return true; - } catch (\Exception $e) { - Db::rollback(); - self::setError($e->getMessage()); - return false; - } - } - - - /** - * @notes 编辑文章点赞 - * @param array $params - * @return bool - * @author likeadmin - * @date 2024/02/18 15:47 - */ - public static function edit(array $params): bool - { - Db::startTrans(); - try { - ArticleLike::where('id', $params['id'])->update([ - 'article_id' => $params['article_id'], - 'state' => $params['state'], - 'like_user' => $params['like_user'] - ]); - - Db::commit(); - return true; - } catch (\Exception $e) { - Db::rollback(); - self::setError($e->getMessage()); - return false; - } - } - - - /** - * @notes 删除文章点赞 - * @param array $params - * @return bool - * @author likeadmin - * @date 2024/02/18 15:47 - */ - public static function delete(array $params): bool - { - return ArticleLike::destroy($params['id']); - } - - - /** - * @notes 获取文章点赞详情 - * @param $params - * @return array - * @author likeadmin - * @date 2024/02/18 15:47 - */ - public static function detail($params): array - { - return ArticleLike::findOrEmpty($params['id'])->toArray(); - } -} \ No newline at end of file diff --git a/app/admin/logic/article/ArticleLogic.php b/app/admin/logic/article/ArticleLogic.php deleted file mode 100644 index 6897008..0000000 --- a/app/admin/logic/article/ArticleLogic.php +++ /dev/null @@ -1,146 +0,0 @@ - $params['title'], - 'state' => $params['state'], - 'top' => $params['top'] - ]); - ArticleContent::create(['article_id' => $res->id, 'content' => $params['content']]); - if ($params['tag']) { - $label_id = Label::whereIn('label_name', $params['tag'])->column('id'); - foreach ($label_id as $v) { - $find = ArticleLabel::where('label_id', $v)->find(); - if (!$find) { - ArticleLabel::create(['article_id' => $res->id, ['label_id'] => $v]); - } - } - } - Db::commit(); - return true; - } catch (\Exception $e) { - Db::rollback(); - self::setError($e->getMessage()); - return false; - } - } - - - /** - * @notes 编辑文章 - * @param array $params - * @return bool - * @author likeadmin - * @date 2024/02/05 16:36 - */ - public static function edit(array $params): bool - { - Db::startTrans(); - try { - Article::where('id', $params['id'])->update([ - 'title_map' => $params['title_map'], - 'title' => $params['title'], - 'state' => $params['state'], - // 'pv' => $params['pv'], - 'top' => $params['top'], - // 'create_user' => $params['create_user'], - // 'update_user' => $params['update_user'] - ]); - $find = ArticleContent::where('article_id', $params['id'])->find(); - if ($find) { - ArticleContent::where('article_id', $params['id'])->update(['content' => $params['content']]); - } else { - ArticleContent::create(['article_id' => $params['id'], 'content' => $params['content']]); - } - if ($params['tag']) { - $arr = []; - $label_arr_id = []; - foreach ($params['tag'] as $vv) { - $arr[] = ['label_name' => $vv]; - $label_id = Label::where('label_name', $vv)->value('id'); - if ($label_id) { - $label_arr_id[] = $label_id; - } else { - $label = Label::create(['label_name' => $vv]); - $label_arr_id[] = $label->id; - } - } - foreach ($label_arr_id as $v) { - $find = ArticleLabel::where('label_id', $v)->find(); - if (!$find) { - ArticleLabel::create(['article_id' => $params['id'], 'label_id' => $v]); - } - } - } - Db::commit(); - return true; - } catch (\Exception $e) { - Db::rollback(); - self::setError($e->getMessage()); - return false; - } - } - - - /** - * @notes 删除文章 - * @param array $params - * @return bool - * @author likeadmin - * @date 2024/02/05 16:36 - */ - public static function delete(array $params): bool - { - return Article::destroy($params['id']); - } - - - /** - * @notes 获取文章详情 - * @param $params - * @return array - * @author likeadmin - * @date 2024/02/05 16:36 - */ - public static function detail($params): array - { - $detail = Article::with('detail')->findOrEmpty($params['id'])->toArray(); - if ($detail) { - $arr = ArticleLabel::where('article_id', $params['id'])->column('label_id'); - if ($arr) { - $detail['tag'] = Label::whereIn('id', $arr)->column('label_name'); - } - } - return $detail; - } -} diff --git a/app/admin/validate/article/ArticleCommentLikeValidate.php b/app/admin/validate/article/ArticleCommentLikeValidate.php deleted file mode 100644 index 998af8b..0000000 --- a/app/admin/validate/article/ArticleCommentLikeValidate.php +++ /dev/null @@ -1,82 +0,0 @@ - 'require', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - ]; - - - /** - * @notes 添加场景 - * @return ArticleCommentLikeValidate - * @author likeadmin - * @date 2024/02/18 15:41 - */ - public function sceneAdd() - { - return $this->remove('id', true); - } - - - /** - * @notes 编辑场景 - * @return ArticleCommentLikeValidate - * @author likeadmin - * @date 2024/02/18 15:41 - */ - public function sceneEdit() - { - return $this->only(['id']); - } - - - /** - * @notes 删除场景 - * @return ArticleCommentLikeValidate - * @author likeadmin - * @date 2024/02/18 15:41 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ArticleCommentLikeValidate - * @author likeadmin - * @date 2024/02/18 15:41 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - -} \ No newline at end of file diff --git a/app/admin/validate/article/ArticleCommentValidate.php b/app/admin/validate/article/ArticleCommentValidate.php deleted file mode 100644 index cc8029f..0000000 --- a/app/admin/validate/article/ArticleCommentValidate.php +++ /dev/null @@ -1,82 +0,0 @@ - 'require', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - ]; - - - /** - * @notes 添加场景 - * @return ArticleCommentValidate - * @author likeadmin - * @date 2024/02/18 15:03 - */ - public function sceneAdd() - { - return $this->remove('id', true); - } - - - /** - * @notes 编辑场景 - * @return ArticleCommentValidate - * @author likeadmin - * @date 2024/02/18 15:03 - */ - public function sceneEdit() - { - return $this->only(['id']); - } - - - /** - * @notes 删除场景 - * @return ArticleCommentValidate - * @author likeadmin - * @date 2024/02/18 15:03 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ArticleCommentValidate - * @author likeadmin - * @date 2024/02/18 15:03 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - -} \ No newline at end of file diff --git a/app/admin/validate/article/ArticleLabelValidate.php b/app/admin/validate/article/ArticleLabelValidate.php deleted file mode 100644 index 6e9964d..0000000 --- a/app/admin/validate/article/ArticleLabelValidate.php +++ /dev/null @@ -1,82 +0,0 @@ - 'require', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - ]; - - - /** - * @notes 添加场景 - * @return ArticleLabelValidate - * @author likeadmin - * @date 2024/02/17 14:07 - */ - public function sceneAdd() - { - return $this->remove('id', true); - } - - - /** - * @notes 编辑场景 - * @return ArticleLabelValidate - * @author likeadmin - * @date 2024/02/17 14:07 - */ - public function sceneEdit() - { - return $this->only(['id']); - } - - - /** - * @notes 删除场景 - * @return ArticleLabelValidate - * @author likeadmin - * @date 2024/02/17 14:07 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ArticleLabelValidate - * @author likeadmin - * @date 2024/02/17 14:07 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - -} \ No newline at end of file diff --git a/app/admin/validate/article/ArticleLikeValidate.php b/app/admin/validate/article/ArticleLikeValidate.php deleted file mode 100644 index 55fbf9c..0000000 --- a/app/admin/validate/article/ArticleLikeValidate.php +++ /dev/null @@ -1,82 +0,0 @@ - 'require', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - ]; - - - /** - * @notes 添加场景 - * @return ArticleLikeValidate - * @author likeadmin - * @date 2024/02/18 15:47 - */ - public function sceneAdd() - { - return $this->remove('id', true); - } - - - /** - * @notes 编辑场景 - * @return ArticleLikeValidate - * @author likeadmin - * @date 2024/02/18 15:47 - */ - public function sceneEdit() - { - return $this->only(['id']); - } - - - /** - * @notes 删除场景 - * @return ArticleLikeValidate - * @author likeadmin - * @date 2024/02/18 15:47 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ArticleLikeValidate - * @author likeadmin - * @date 2024/02/18 15:47 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - -} \ No newline at end of file diff --git a/app/admin/validate/article/ArticleValidate.php b/app/admin/validate/article/ArticleValidate.php deleted file mode 100644 index 00f73f5..0000000 --- a/app/admin/validate/article/ArticleValidate.php +++ /dev/null @@ -1,82 +0,0 @@ - 'require', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - ]; - - - /** - * @notes 添加场景 - * @return ArticleValidate - * @author likeadmin - * @date 2024/02/05 16:36 - */ - public function sceneAdd() - { - return $this->remove('id', true); - } - - - /** - * @notes 编辑场景 - * @return ArticleValidate - * @author likeadmin - * @date 2024/02/05 16:36 - */ - public function sceneEdit() - { - return $this->only(['id']); - } - - - /** - * @notes 删除场景 - * @return ArticleValidate - * @author likeadmin - * @date 2024/02/05 16:36 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ArticleValidate - * @author likeadmin - * @date 2024/02/05 16:36 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - -} \ No newline at end of file diff --git a/app/common/model/article/Article.php b/app/common/model/article/Article.php deleted file mode 100644 index 0e1ef04..0000000 --- a/app/common/model/article/Article.php +++ /dev/null @@ -1,25 +0,0 @@ -hasOne(ArticleContent::class,'article_id')->bind(['content']); - } -} \ No newline at end of file diff --git a/app/common/model/article/ArticleComment.php b/app/common/model/article/ArticleComment.php deleted file mode 100644 index 433376f..0000000 --- a/app/common/model/article/ArticleComment.php +++ /dev/null @@ -1,26 +0,0 @@ -hasOne(Article::class,'id','article_id')->bind(['article_title'=>'title']); - } - -} \ No newline at end of file diff --git a/app/common/model/article/ArticleCommentLike.php b/app/common/model/article/ArticleCommentLike.php deleted file mode 100644 index 127ab5a..0000000 --- a/app/common/model/article/ArticleCommentLike.php +++ /dev/null @@ -1,22 +0,0 @@ -