resolve($request); } catch (PlayerAuthenticationException $e) { // msg:多语言用户提示;code / httpStatus:仍来自异常内业务定义 return ApiResponse::error( LotteryMessage::sso($request, $e->lotteryCode), $e->lotteryCode, null, $e->httpStatus, ); } // 使用 attributes,避免与 Laravel 内置 input 混淆 $request->attributes->set('lottery_player', $player); // 广播私有频道授权使用 Request::user() 读取当前玩家。 $request->setUserResolver(static fn () => $player); return $next($request); } }