From 5f9928593e5576fc5ff06c5644f5735742692b95 Mon Sep 17 00:00:00 2001 From: xiaochong0302 Date: Fri, 8 Dec 2023 20:17:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=89=B9=E9=87=8F=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E5=90=8E=E7=9A=84=E8=B7=B3=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Caches/CategoryAllList.php | 12 ++++-------- app/Caches/CategoryList.php | 4 ---- app/Http/Admin/Controllers/AnswerController.php | 4 +--- app/Http/Admin/Controllers/ArticleController.php | 8 +------- app/Http/Admin/Controllers/CommentController.php | 6 ++---- app/Http/Admin/Controllers/ConsultController.php | 4 +--- app/Http/Admin/Controllers/QuestionController.php | 4 +--- app/Http/Admin/Controllers/ReviewController.php | 4 +--- app/Http/Admin/Services/Article.php | 2 +- app/Http/Admin/Services/Question.php | 2 +- 10 files changed, 13 insertions(+), 37 deletions(-) diff --git a/app/Caches/CategoryAllList.php b/app/Caches/CategoryAllList.php index 5fdfbc08..01866cc0 100644 --- a/app/Caches/CategoryAllList.php +++ b/app/Caches/CategoryAllList.php @@ -20,23 +20,19 @@ class CategoryAllList extends Cache return $this->lifetime; } - public function getKey($type = null) + public function getKey($id = null) { - return "category_all_list:{$type}"; + return "category_all_list:{$id}"; } - /** - * @param null $type - * @return array - */ - public function getContent($type = null) + public function getContent($id = null) { /** * @var Resultset $categories */ $categories = CategoryModel::query() ->columns(['id', 'parent_id', 'name', 'priority', 'level', 'path']) - ->where('type = :type:', ['type' => $type]) + ->where('type = :type:', ['type' => $id]) ->orderBy('level ASC, priority ASC') ->execute(); diff --git a/app/Caches/CategoryList.php b/app/Caches/CategoryList.php index 78a203eb..aede8d99 100644 --- a/app/Caches/CategoryList.php +++ b/app/Caches/CategoryList.php @@ -25,10 +25,6 @@ class CategoryList extends Cache return "category_list:{$id}"; } - /** - * @param null $id - * @return array - */ public function getContent($id = null) { /** diff --git a/app/Http/Admin/Controllers/AnswerController.php b/app/Http/Admin/Controllers/AnswerController.php index 69cc0846..b0ecffa5 100644 --- a/app/Http/Admin/Controllers/AnswerController.php +++ b/app/Http/Admin/Controllers/AnswerController.php @@ -247,10 +247,8 @@ class AnswerController extends Controller $answerService->batchDelete(); - $location = $this->url->get(['for' => 'admin.answer.list']); - $content = [ - 'location' => $location, + 'location' => $this->request->getHTTPReferer(), 'msg' => '批量删除成功', ]; diff --git a/app/Http/Admin/Controllers/ArticleController.php b/app/Http/Admin/Controllers/ArticleController.php index 05689bb4..2da839d3 100644 --- a/app/Http/Admin/Controllers/ArticleController.php +++ b/app/Http/Admin/Controllers/ArticleController.php @@ -64,11 +64,7 @@ class ArticleController extends Controller */ public function addAction() { - $articleService = new ArticleService(); - $categories = $articleService->getCategories(); - - $this->view->setVar('categories', $categories); } /** @@ -257,10 +253,8 @@ class ArticleController extends Controller $articleService->batchDelete(); - $location = $this->url->get(['for' => 'admin.mod.articles']); - $content = [ - 'location' => $location, + 'location' => $this->request->getHTTPReferer(), 'msg' => '批量删除成功', ]; diff --git a/app/Http/Admin/Controllers/CommentController.php b/app/Http/Admin/Controllers/CommentController.php index a34340aa..eea1a474 100644 --- a/app/Http/Admin/Controllers/CommentController.php +++ b/app/Http/Admin/Controllers/CommentController.php @@ -167,11 +167,9 @@ class CommentController extends Controller $commentService->batchDelete(); - $location = $this->url->get(['for' => 'admin.mod.comments']); - $content = [ - 'location' => $location, - 'msg' => '批量审核成功', + 'location' => $this->request->getHTTPReferer(), + 'msg' => '批量删除成功', ]; return $this->jsonSuccess($content); diff --git a/app/Http/Admin/Controllers/ConsultController.php b/app/Http/Admin/Controllers/ConsultController.php index ac3aea38..7f66dcf5 100644 --- a/app/Http/Admin/Controllers/ConsultController.php +++ b/app/Http/Admin/Controllers/ConsultController.php @@ -172,10 +172,8 @@ class ConsultController extends Controller $consultService->batchDelete(); - $location = $this->url->get(['for' => 'admin.mod.consults']); - $content = [ - 'location' => $location, + 'location' => $this->request->getHTTPReferer(), 'msg' => '批量删除成功', ]; diff --git a/app/Http/Admin/Controllers/QuestionController.php b/app/Http/Admin/Controllers/QuestionController.php index 7496f57b..f6140c1f 100644 --- a/app/Http/Admin/Controllers/QuestionController.php +++ b/app/Http/Admin/Controllers/QuestionController.php @@ -248,10 +248,8 @@ class QuestionController extends Controller $questionService->batchDelete(); - $location = $this->url->get(['for' => 'admin.question.list']); - $content = [ - 'location' => $location, + 'location' => $this->request->getHTTPReferer(), 'msg' => '批量删除成功', ]; diff --git a/app/Http/Admin/Controllers/ReviewController.php b/app/Http/Admin/Controllers/ReviewController.php index b853ae6b..3013dd78 100644 --- a/app/Http/Admin/Controllers/ReviewController.php +++ b/app/Http/Admin/Controllers/ReviewController.php @@ -174,10 +174,8 @@ class ReviewController extends Controller $reviewService->batchDelete(); - $location = $this->url->get(['for' => 'admin.mod.reviews']); - $content = [ - 'location' => $location, + 'location' => $this->request->getHTTPReferer(), 'msg' => '批量删除成功', ]; diff --git a/app/Http/Admin/Services/Article.php b/app/Http/Admin/Services/Article.php index dd445fdb..115d0f80 100644 --- a/app/Http/Admin/Services/Article.php +++ b/app/Http/Admin/Services/Article.php @@ -379,7 +379,7 @@ class Article extends Service foreach ($articles as $article) { - $article->published = ArticleModel::PUBLISH_REJECTED; + $article->deleted = 1; $article->update(); $this->handleArticleDeletedNotice($article, $sender); diff --git a/app/Http/Admin/Services/Question.php b/app/Http/Admin/Services/Question.php index 7a5f2102..18bfc401 100644 --- a/app/Http/Admin/Services/Question.php +++ b/app/Http/Admin/Services/Question.php @@ -364,7 +364,7 @@ class Question extends Service foreach ($questions as $question) { - $question->published = QuestionModel::PUBLISH_REJECTED; + $question->deleted = 1; $question->update(); $this->handleQuestionDeletedNotice($question, $sender);