This commit is contained in:
weiz 2024-05-29 11:22:16 +08:00
parent eff40225f5
commit 4536b2962b

View File

@ -154,11 +154,14 @@ class AdminController extends BaseAdminController
//获取所有人员 //获取所有人员
public function getAdminsByAll(): \think\response\Json public function getAdminsByAll(): \think\response\Json
{ {
$params = $this->request->get(['exclude_id']); $params = $this->request->get(['exclude_id','org_id']);
$where = []; $where = [];
if(!empty($params['exclude_id'])){ if(!empty($params['exclude_id'])){
$where[] = ['id','<>',$params['exclude_id']]; $where[] = ['id','<>',$params['exclude_id']];
} }
if(!empty($params['org_id'])){
$where[] = ['org_id','<>',$params['org_id']];
}
$data = Admin::field('id,name,avatar,org_id,dept_id,job_id')->where($where)->select()->each(function($item){ $data = Admin::field('id,name,avatar,org_id,dept_id,job_id')->where($where)->select()->each(function($item){
$job = Jobs::field('name')->where('id',$item['job_id'])->findOrEmpty(); $job = Jobs::field('name')->where('id',$item['job_id'])->findOrEmpty();
$dept = Dept::field('name')->where('id',$item['dept_id'])->findOrEmpty(); $dept = Dept::field('name')->where('id',$item['dept_id'])->findOrEmpty();