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") */