This commit is contained in:
chenbo 2023-12-04 13:42:17 +08:00
parent 91e77b712c
commit 066e8c4382

@ -39,6 +39,10 @@ class UserLists extends BaseAdminDataLists implements ListsExcelInterface
public function setSearch(): array
{
$allowSearch = ['keyword', 'channel', 'create_time_start', 'create_time_end', 'company_id'];
if (empty($this->params['company_id'])) {
unset($allowSearch['company_id']);
unset($this->params['company_id']);
}
return array_intersect(array_keys($this->params), $allowSearch);
}
@ -68,13 +72,15 @@ class UserLists extends BaseAdminDataLists implements ListsExcelInterface
}
}
$field = "id,id contract,sn,nickname,sex,avatar,account,mobile,channel,create_time,admin_id,company_id,street,street as street_name,is_contract";
$lists = User::withSearch($this->setSearch(), $this->params)
->field($field)
->where($where)
->with(['company'])
->order('id desc')
->where($where)
->limit($this->limitOffset, $this->limitLength)
->field($field)
->order('id desc')
->select()
->toArray();