1.重构实时消息WebSocket连接

2.MySQL备份
This commit is contained in:
2026-04-24 13:49:38 +08:00
parent d69412a0f7
commit fd324f2882
54 changed files with 2396 additions and 2638 deletions

View File

@@ -134,33 +134,6 @@ final class GameBetSettleService
GameHotDataCoordinator::afterUserCommitted($userId);
}
foreach ($aggregateByUser as $userId => $agg) {
$hitOrderCount = 0;
foreach ($agg['orders'] as $o) {
if (($o['hit'] ?? false) === true) {
$hitOrderCount++;
}
}
UserPushService::publish((int) $userId, UserPushService::EVT_BET_SETTLED, [
'period_no' => $agg['period_no'],
'result_number' => $resultNumber,
'total_win_amount' => $agg['total_win'],
'order_count' => count($agg['orders']),
'hit_order_count' => $hitOrderCount,
'balance_after' => $agg['balance_after'],
]);
if (bccomp($agg['total_win'], '0', 2) > 0) {
UserPushService::publish((int) $userId, UserPushService::EVT_WALLET_CHANGED, [
'reason' => 'payout',
'ref_type' => 'game_period',
'ref_id' => (string) $recordId,
'delta' => $agg['total_win'],
'balance_after' => $agg['balance_after'],
]);
}
}
$jackpotHits = [];
foreach ($jackpotNotify as $uid => $_) {
if (!isset($aggregateByUser[$uid])) {
@@ -210,9 +183,8 @@ final class GameBetSettleService
}
Db::startTrans();
try {
$out = self::settleBetsForDraw($rid, $rn);
self::settleBetsForDraw($rid, $rn);
Db::commit();
JackpotPushService::publishHits($out['jackpot_hits'] ?? []);
$count++;
} catch (Throwable $e) {
Db::rollback();
@@ -322,6 +294,13 @@ final class GameBetSettleService
'update_time' => $now,
]);
GameHotDataCoordinator::afterUserCommitted($userId);
GameWebSocketEventBus::publish('wallet.changed', [
'user_id' => $userId,
'balance_after' => $after,
'biz_type' => 'payout',
'ref_id' => $betId,
'changed_at' => $now,
]);
return $after;
}