orWhere("email",$data['username'])->first(); if(is_null($u)) { throw new ClientException("账号或密码错误,请重新输入"); } if(!$u->checkPassword($data['password'])) { throw new ClientException("账号或密码错误,请重新输入!"); } if($u->status != User::STATUS_OK) { throw new ClientException("当前用户被禁用,请联系管理员"); } return $u; } }