where(function ($query)use ($param){ if(Arr::get($param,'id')){ $query->where('id',$param['id']); } if(Arr::get($param,'mobile')){ $query->where('mobile',$param['mobile']); } })->first(); if(empty($data)){ throw new \Exception('账号不存在'); } }catch (\Throwable $exception){ throw new \Exception($exception->getMessage()); } return collect($data)->toArray(); } }