From 124b28856f700c8c5f438c657c33b5191229c9f7 Mon Sep 17 00:00:00 2001 From: koogua Date: Tue, 28 Sep 2021 17:33:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=88=A0=E9=99=A4=E6=96=87?= =?UTF-8?q?=E7=AB=A0=E5=92=8C=E6=8F=90=E9=97=AE=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + app/Http/Api/Controllers/AnswerController.php | 2 +- app/Http/Api/Controllers/ArticleController.php | 13 +++++++++++++ app/Http/Api/Controllers/CommentController.php | 2 +- app/Http/Api/Controllers/QuestionController.php | 13 +++++++++++++ 5 files changed, 29 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e66998d5..e5c1c0ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - 调整登录限制(邮箱|手机)为注册限制 - 调整订单发货为每一分钟执行一次 - 增强课时安全性,无权限时不返回播放地址或内容 +- 增加删除文章和提问接口 - 增加首页推荐教师接口 - 增加微信公众号支付处理 - 增加取消订单功能 diff --git a/app/Http/Api/Controllers/AnswerController.php b/app/Http/Api/Controllers/AnswerController.php index 79c1c416..979f5827 100644 --- a/app/Http/Api/Controllers/AnswerController.php +++ b/app/Http/Api/Controllers/AnswerController.php @@ -82,7 +82,7 @@ class AnswerController extends Controller $service->handle($id); - return $this->jsonSuccess(['msg' => '删除回答成功']); + return $this->jsonSuccess(); } /** diff --git a/app/Http/Api/Controllers/ArticleController.php b/app/Http/Api/Controllers/ArticleController.php index fa636c57..10db6ded 100644 --- a/app/Http/Api/Controllers/ArticleController.php +++ b/app/Http/Api/Controllers/ArticleController.php @@ -7,6 +7,7 @@ namespace App\Http\Api\Controllers; +use App\Services\Logic\Article\ArticleDelete as ArticleDeleteService; use App\Services\Logic\Article\ArticleFavorite as ArticleFavoriteService; use App\Services\Logic\Article\ArticleInfo as ArticleInfoService; use App\Services\Logic\Article\ArticleLike as ArticleLikeService; @@ -68,6 +69,18 @@ class ArticleController extends Controller return $this->jsonPaginate($pager); } + /** + * @Post("/{id:[0-9]+}/delete", name="api.article.delete") + */ + public function deleteAction($id) + { + $service = new ArticleDeleteService(); + + $service->handle($id); + + return $this->jsonSuccess(); + } + /** * @Post("/{id:[0-9]+}/favorite", name="api.article.favorite") */ diff --git a/app/Http/Api/Controllers/CommentController.php b/app/Http/Api/Controllers/CommentController.php index 4e9031c2..55e8a9a2 100644 --- a/app/Http/Api/Controllers/CommentController.php +++ b/app/Http/Api/Controllers/CommentController.php @@ -85,7 +85,7 @@ class CommentController extends Controller $service->handle($id); - return $this->jsonSuccess(['msg' => '删除评论成功']); + return $this->jsonSuccess(); } /** diff --git a/app/Http/Api/Controllers/QuestionController.php b/app/Http/Api/Controllers/QuestionController.php index d76c82bb..3ba26c90 100644 --- a/app/Http/Api/Controllers/QuestionController.php +++ b/app/Http/Api/Controllers/QuestionController.php @@ -10,6 +10,7 @@ namespace App\Http\Api\Controllers; use App\Services\Logic\Question\AnswerList as AnswerListService; use App\Services\Logic\Question\CategoryList as CategoryListService; use App\Services\Logic\Question\CommentList as CommentListService; +use App\Services\Logic\Question\QuestionDelete as QuestionDeleteService; use App\Services\Logic\Question\QuestionFavorite as QuestionFavoriteService; use App\Services\Logic\Question\QuestionInfo as QuestionInfoService; use App\Services\Logic\Question\QuestionLike as QuestionLikeService; @@ -81,6 +82,18 @@ class QuestionController extends Controller return $this->jsonPaginate($pager); } + /** + * @Post("/{id:[0-9]+}/delete", name="api.question.delete") + */ + public function deleteAction($id) + { + $service = new QuestionDeleteService(); + + $service->handle($id); + + return $this->jsonSuccess(); + } + /** * @Post("/{id:[0-9]+}/favorite", name="api.question.favorite") */