belongsTo(UserLevel::class); } //用户登录 public static function login($param) { $username = $param['username']; $password = $param['password']; $user = self::get(['username' => $username]); if (!$user) { exception('用户不存在'); } if (!password_verify($password, $user->password)) { exception('密码错误'); } if ((int)$user->status !== 1) { exception('用户被冻结'); } return $user; } }