1.优化中奖事件统一使用bet.win订阅中奖消息

This commit is contained in:
2026-05-26 15:36:22 +08:00
parent d8d03662ed
commit 38dec9d7a2
2 changed files with 40 additions and 3 deletions

View File

@@ -17,10 +17,12 @@ final class StreakWinReward
/** @var list<array{streak: int, odds_factor: int, is_jackpot: bool}>|null */
private static ?array $cache = null;
private static ?string $cacheConfigValue = null;
public static function clearCache(): void
{
self::$cache = null;
self::$cacheConfigValue = null;
}
/**
@@ -97,11 +99,16 @@ final class StreakWinReward
*/
public static function loadRows(): array
{
if (self::$cache !== null) {
$row = GameHotDataRedis::gameConfigRow(self::CONFIG_KEY);
$rawValue = $row['config_value'] ?? null;
$normalizedRaw = is_string($rawValue) ? trim($rawValue) : (is_numeric($rawValue) ? (string) $rawValue : '');
if (self::$cache !== null && self::$cacheConfigValue === $normalizedRaw) {
return self::$cache;
}
$row = GameHotDataRedis::gameConfigRow(self::CONFIG_KEY);
self::$cache = self::parseFromConfigValue($row['config_value'] ?? null);
self::$cache = self::parseFromConfigValue($normalizedRaw);
self::$cacheConfigValue = $normalizedRaw;
return self::$cache;
}