From d8d03662ed952e289c336c44f356c88634818ffe Mon Sep 17 00:00:00 2001 From: zhenhui <1276357500@qq.com> Date: Tue, 26 May 2026 15:19:21 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BC=98=E5=8C=96=E4=B8=AD=E5=A5=96=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6=E7=BB=9F=E4=B8=80=E4=BD=BF=E7=94=A8bet.win=E8=AE=A2?= =?UTF-8?q?=E9=98=85=E4=B8=AD=E5=A5=96=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/service/GameBetSettleService.php | 10 +++++++++- app/common/service/GameWebSocketPayloadHelper.php | 11 +++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/app/common/service/GameBetSettleService.php b/app/common/service/GameBetSettleService.php index d901a5f..6b11367 100644 --- a/app/common/service/GameBetSettleService.php +++ b/app/common/service/GameBetSettleService.php @@ -180,7 +180,15 @@ final class GameBetSettleService 'update_time' => $now, ]); GameHotDataCoordinator::afterUserCommitted($userId); - GameWebSocketPayloadHelper::publishUserStreak($userId, $next); + $periodNo = isset($aggregateByUser[$userId]['period_no']) ? (string) $aggregateByUser[$userId]['period_no'] : ''; + GameWebSocketPayloadHelper::publishUserStreak($userId, $next, [ + // 明确标记本期结算结果,客户端可直接判断“当前用户是否中奖”。 + 'is_win' => $hadWin, + 'period_id' => $recordId, + 'period_no' => $periodNo, + 'result_number' => $resultNumber, + 'settled_at' => $now, + ]); } $jackpotHits = []; diff --git a/app/common/service/GameWebSocketPayloadHelper.php b/app/common/service/GameWebSocketPayloadHelper.php index 3baa775..c55aed1 100644 --- a/app/common/service/GameWebSocketPayloadHelper.php +++ b/app/common/service/GameWebSocketPayloadHelper.php @@ -66,12 +66,19 @@ final class GameWebSocketPayloadHelper return array_merge($payload, self::userStreakData($userId, $currentStreak)); } - public static function publishUserStreak(int $userId, ?int $currentStreak = null): void + /** + * @param array $extra + */ + public static function publishUserStreak(int $userId, ?int $currentStreak = null, array $extra = []): void { if ($userId <= 0) { return; } - GameWebSocketEventBus::publish(self::TOPIC_USER_STREAK, self::userStreakData($userId, $currentStreak)); + $payload = self::userStreakData($userId, $currentStreak); + if ($extra !== []) { + $payload = array_merge($payload, $extra); + } + GameWebSocketEventBus::publish(self::TOPIC_USER_STREAK, $payload); } /**