From a4ac1b426af704b7f1c8581fafd3e5546b452a3a Mon Sep 17 00:00:00 2001 From: evoxwht <442384644@qq.com> Date: Wed, 28 Jun 2023 14:34:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=99=84=E4=BB=B6=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../adminapi/controller/v1/file/SystemAttachment.php | 3 ++- .../app/model/system/attachment/SystemAttachment.php | 12 +++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/crmeb/app/adminapi/controller/v1/file/SystemAttachment.php b/crmeb/app/adminapi/controller/v1/file/SystemAttachment.php index e6dbb12b4..ef6a44781 100644 --- a/crmeb/app/adminapi/controller/v1/file/SystemAttachment.php +++ b/crmeb/app/adminapi/controller/v1/file/SystemAttachment.php @@ -43,7 +43,8 @@ class SystemAttachment extends AuthController public function index() { $where = $this->request->getMore([ - ['pid', 0] + ['pid', 0], + ['real_name', ''] ]); return app('json')->success($this->service->getImageList($where)); } diff --git a/crmeb/app/model/system/attachment/SystemAttachment.php b/crmeb/app/model/system/attachment/SystemAttachment.php index 2b2e86b45..0acadcff1 100644 --- a/crmeb/app/model/system/attachment/SystemAttachment.php +++ b/crmeb/app/model/system/attachment/SystemAttachment.php @@ -63,6 +63,16 @@ class SystemAttachment extends BaseModel */ public function searchLikeNameAttr($query, $value) { - if ($value) $query->where('name','LIKE' ,"$value%"); + if ($value) $query->where('name', 'LIKE', "$value%"); + } + + /** + * real_name模糊搜索 + * @param Model $query + * @param $value + */ + public function searchRealNameAttr($query, $value) + { + if ($value != '') $query->where('real_name', 'LIKE', "%$value%"); } }