From fbd62313203973fe982507b95e579f1a7f5964eb Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Wed, 17 Dec 2025 11:21:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E7=B1=BB=E4=B8=8B=E6=8B=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/controller/PostCategoryController.php | 15 +++++++++++++++ config/route.php | 1 + 2 files changed, 16 insertions(+) diff --git a/app/admin/controller/PostCategoryController.php b/app/admin/controller/PostCategoryController.php index 23ef772..e894c5c 100644 --- a/app/admin/controller/PostCategoryController.php +++ b/app/admin/controller/PostCategoryController.php @@ -18,6 +18,21 @@ class PostCategoryController extends BaseController $this->service = new PostCategoryService(); } + public function preset(Request $request) + { + try { + $raw = $this->service->serviceListAll($request); + $data = []; + foreach ($raw as $item) { + unset($item['created_at']); + unset($item['updated_at']); + $data[] = $this->indexFormat($item); + } + return $this->success($data); + } catch (\Throwable $e) { + return $this->error($e->getMessage()); + } + } /** * 分类树 diff --git a/config/route.php b/config/route.php index 0ef5f2b..0b39ab2 100644 --- a/config/route.php +++ b/config/route.php @@ -177,6 +177,7 @@ Route::group('/admin', function () { Route::any('/store', [app\admin\controller\PostCategoryController::class, 'store']); Route::any('/update', [app\admin\controller\PostCategoryController::class, 'update']); Route::any('/destroy', [app\admin\controller\PostCategoryController::class, 'destroy']); + Route::any('/preset', [app\admin\controller\PostCategoryController::class, 'preset']); }); // 点赞