From 0b5ae13afdf2f73cd5bbd025bbe6d42b6d597ac2 Mon Sep 17 00:00:00 2001 From: jsasg <735273025@qq.com> Date: Mon, 31 Mar 2025 14:31:28 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E4=BF=AE=E6=94=B9=E9=99=84?= =?UTF-8?q?=E4=BB=B6=E5=88=86=E7=B1=BB=E5=88=97=E8=A1=A8=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/controller/v1/AttachmentCategory.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/admin/controller/v1/AttachmentCategory.php b/app/admin/controller/v1/AttachmentCategory.php index 3d87c113..cc0c4b45 100644 --- a/app/admin/controller/v1/AttachmentCategory.php +++ b/app/admin/controller/v1/AttachmentCategory.php @@ -18,6 +18,7 @@ class AttachmentCategory { $params = request()->param([ 'name', + 'is_show', 'page/d' => 1, 'size/d' => 10 ]); @@ -39,7 +40,13 @@ class AttachmentCategory 'page' => $params['page'] ]); } else if ('all' == request()->param('scene')) { - $categorys = $categorys->isShow()->select()->hidden(['sort', 'is_show']); + $categorys = $categorys->where(function($query) use($params) { + if (isset($params['is_show'])) { + $query->where('is_show', '=', $params['is_show']); + } + }) + ->select() + ->hidden(['sort', 'is_show']); } return success('获取成功', $categorys);