1.优化中奖事件统一使用bet.win订阅中奖消息
This commit is contained in:
@@ -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 = [];
|
||||
|
||||
@@ -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<string, mixed> $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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user