1.优化中奖事件统一使用bet.win订阅中奖消息
This commit is contained in:
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace app\common\service;
|
||||
|
||||
use app\common\library\game\StreakWinReward;
|
||||
use support\Log;
|
||||
use support\think\Db;
|
||||
use Throwable;
|
||||
|
||||
@@ -191,6 +192,35 @@ final class GameBetSettleService
|
||||
]);
|
||||
}
|
||||
|
||||
// 兜底:若已判定本期中奖(is_win=true),但聚合中奖事件意外缺失,补一条 bet.win,保证客户端可感知中奖。
|
||||
foreach ($userOutcome as $userId => $info) {
|
||||
$hadWin = (bool) ($info['had_win'] ?? false);
|
||||
if (!$hadWin || isset($winByUser[$userId])) {
|
||||
continue;
|
||||
}
|
||||
$agg = $aggregateByUser[$userId] ?? null;
|
||||
if (!is_array($agg) || bccomp((string) ($agg['total_win'] ?? '0.00'), '0', 2) <= 0) {
|
||||
continue;
|
||||
}
|
||||
$isJackpotTier = isset($jackpotNotify[$userId]);
|
||||
$winByUser[$userId] = [
|
||||
'user_id' => $userId,
|
||||
'period_id' => $recordId,
|
||||
'period_no' => (string) ($agg['period_no'] ?? ''),
|
||||
'result_number' => $resultNumber,
|
||||
'total_win' => (string) ($agg['total_win'] ?? '0.00'),
|
||||
'balance_after' => (string) ($agg['balance_after'] ?? '0'),
|
||||
'is_jackpot' => $isJackpotTier,
|
||||
'bets' => [],
|
||||
];
|
||||
Log::warning('bet.win fallback emitted for settled winner', [
|
||||
'user_id' => $userId,
|
||||
'period_id' => $recordId,
|
||||
'period_no' => (string) ($agg['period_no'] ?? ''),
|
||||
'is_jackpot' => $isJackpotTier,
|
||||
]);
|
||||
}
|
||||
|
||||
$jackpotHits = [];
|
||||
$hitUserIds = [];
|
||||
foreach ($jackpotNotify as $uid => $_) {
|
||||
|
||||
Reference in New Issue
Block a user