This commit is contained in:
weiz 2024-01-20 15:59:05 +08:00
parent e8909c74cf
commit f351126770

View File

@ -57,12 +57,16 @@ class CustomFollowLists extends BaseAdminDataLists implements ListsSearchInterfa
*/ */
public function lists(): array public function lists(): array
{ {
$params = $this->request->get(); $params = $this->request->get(['custom_name','contacts']);
$where = []; $where = [];
if(isset($params['custom_name']) && $params['custom_name'] != ''){ if(isset($params['custom_name']) && $params['custom_name'] != ''){
$custom_ids = Custom::where('name','like','%'.$params['custom_name'].'%')->column('id'); $custom_ids = Custom::where('name','like','%'.$params['custom_name'].'%')->column('id');
$where[] = ['custom_id','in',$custom_ids]; $where[] = ['custom_id','in',$custom_ids];
} }
if(isset($params['contacts']) && $params['contacts'] != ''){
$custom_ids = Custom::where('custom_name','like','%'.$params['contacts'].'%')->column('id');
$where[] = ['custom_id','in',$custom_ids];
}
return CustomFollow::field('id,custom_id,name,date,types,executor,description,coordinate,next_follow_date,add_user,update_user,create_time,update_time') return CustomFollow::field('id,custom_id,name,date,types,executor,description,coordinate,next_follow_date,add_user,update_user,create_time,update_time')
->where($this->searchWhere)->where($where) ->where($this->searchWhere)->where($where)
->limit($this->limitOffset, $this->limitLength) ->limit($this->limitOffset, $this->limitLength)
@ -89,12 +93,16 @@ class CustomFollowLists extends BaseAdminDataLists implements ListsSearchInterfa
*/ */
public function count(): int public function count(): int
{ {
$params = $this->request->get(); $params = $this->request->get(['custom_name','contacts']);
$where = []; $where = [];
if(isset($params['custom_name']) && $params['custom_name'] != ''){ if(isset($params['custom_name']) && $params['custom_name'] != ''){
$custom_ids = Custom::where('name','like','%'.$params['custom_name'].'%')->column('id'); $custom_ids = Custom::where('name','like','%'.$params['custom_name'].'%')->column('id');
$where[] = ['custom_id','in',$custom_ids]; $where[] = ['custom_id','in',$custom_ids];
} }
if(isset($params['contacts']) && $params['contacts'] != ''){
$custom_ids = Custom::where('custom_name','like','%'.$params['contacts'].'%')->column('id');
$where[] = ['custom_id','in',$custom_ids];
}
return CustomFollow::where($this->searchWhere)->where($where)->count(); return CustomFollow::where($this->searchWhere)->where($where)->count();
} }