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%"); } }