1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-06-25 04:07:17 +08:00

优化批量删除后的跳转

This commit is contained in:
xiaochong0302 2023-12-08 20:17:39 +08:00
parent 2195904e65
commit 5f9928593e
10 changed files with 13 additions and 37 deletions

View File

@ -20,23 +20,19 @@ class CategoryAllList extends Cache
return $this->lifetime; return $this->lifetime;
} }
public function getKey($type = null) public function getKey($id = null)
{ {
return "category_all_list:{$type}"; return "category_all_list:{$id}";
} }
/** public function getContent($id = null)
* @param null $type
* @return array
*/
public function getContent($type = null)
{ {
/** /**
* @var Resultset $categories * @var Resultset $categories
*/ */
$categories = CategoryModel::query() $categories = CategoryModel::query()
->columns(['id', 'parent_id', 'name', 'priority', 'level', 'path']) ->columns(['id', 'parent_id', 'name', 'priority', 'level', 'path'])
->where('type = :type:', ['type' => $type]) ->where('type = :type:', ['type' => $id])
->orderBy('level ASC, priority ASC') ->orderBy('level ASC, priority ASC')
->execute(); ->execute();

View File

@ -25,10 +25,6 @@ class CategoryList extends Cache
return "category_list:{$id}"; return "category_list:{$id}";
} }
/**
* @param null $id
* @return array
*/
public function getContent($id = null) public function getContent($id = null)
{ {
/** /**

View File

@ -247,10 +247,8 @@ class AnswerController extends Controller
$answerService->batchDelete(); $answerService->batchDelete();
$location = $this->url->get(['for' => 'admin.answer.list']);
$content = [ $content = [
'location' => $location, 'location' => $this->request->getHTTPReferer(),
'msg' => '批量删除成功', 'msg' => '批量删除成功',
]; ];

View File

@ -64,11 +64,7 @@ class ArticleController extends Controller
*/ */
public function addAction() public function addAction()
{ {
$articleService = new ArticleService();
$categories = $articleService->getCategories();
$this->view->setVar('categories', $categories);
} }
/** /**
@ -257,10 +253,8 @@ class ArticleController extends Controller
$articleService->batchDelete(); $articleService->batchDelete();
$location = $this->url->get(['for' => 'admin.mod.articles']);
$content = [ $content = [
'location' => $location, 'location' => $this->request->getHTTPReferer(),
'msg' => '批量删除成功', 'msg' => '批量删除成功',
]; ];

View File

@ -167,11 +167,9 @@ class CommentController extends Controller
$commentService->batchDelete(); $commentService->batchDelete();
$location = $this->url->get(['for' => 'admin.mod.comments']);
$content = [ $content = [
'location' => $location, 'location' => $this->request->getHTTPReferer(),
'msg' => '批量审核成功', 'msg' => '批量删除成功',
]; ];
return $this->jsonSuccess($content); return $this->jsonSuccess($content);

View File

@ -172,10 +172,8 @@ class ConsultController extends Controller
$consultService->batchDelete(); $consultService->batchDelete();
$location = $this->url->get(['for' => 'admin.mod.consults']);
$content = [ $content = [
'location' => $location, 'location' => $this->request->getHTTPReferer(),
'msg' => '批量删除成功', 'msg' => '批量删除成功',
]; ];

View File

@ -248,10 +248,8 @@ class QuestionController extends Controller
$questionService->batchDelete(); $questionService->batchDelete();
$location = $this->url->get(['for' => 'admin.question.list']);
$content = [ $content = [
'location' => $location, 'location' => $this->request->getHTTPReferer(),
'msg' => '批量删除成功', 'msg' => '批量删除成功',
]; ];

View File

@ -174,10 +174,8 @@ class ReviewController extends Controller
$reviewService->batchDelete(); $reviewService->batchDelete();
$location = $this->url->get(['for' => 'admin.mod.reviews']);
$content = [ $content = [
'location' => $location, 'location' => $this->request->getHTTPReferer(),
'msg' => '批量删除成功', 'msg' => '批量删除成功',
]; ];

View File

@ -379,7 +379,7 @@ class Article extends Service
foreach ($articles as $article) { foreach ($articles as $article) {
$article->published = ArticleModel::PUBLISH_REJECTED; $article->deleted = 1;
$article->update(); $article->update();
$this->handleArticleDeletedNotice($article, $sender); $this->handleArticleDeletedNotice($article, $sender);

View File

@ -364,7 +364,7 @@ class Question extends Service
foreach ($questions as $question) { foreach ($questions as $question) {
$question->published = QuestionModel::PUBLISH_REJECTED; $question->deleted = 1;
$question->update(); $question->update();
$this->handleQuestionDeletedNotice($question, $sender); $this->handleQuestionDeletedNotice($question, $sender);