增加附件图片搜索

This commit is contained in:
evoxwht 2023-06-28 14:34:13 +08:00
parent 637aade62a
commit a4ac1b426a
2 changed files with 13 additions and 2 deletions

View File

@ -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));
}

View File

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