1.修复自动创建下一期bug
This commit is contained in:
@@ -99,12 +99,25 @@ final class GameLiveService
|
||||
return;
|
||||
}
|
||||
|
||||
$pendingCount = (int) Db::name('bet_order')
|
||||
->where('period_id', $recordId)
|
||||
->where('status', GameBetSettleService::PLAY_STATUS_PENDING_DRAW)
|
||||
->count();
|
||||
|
||||
$now = time();
|
||||
$payoutUntil = isset($row['payout_until']) ? (int) $row['payout_until'] : 0;
|
||||
$settleOut = ['jackpot_hits' => [], 'bet_wins' => []];
|
||||
$settleOut = [
|
||||
'jackpot_hits' => [],
|
||||
'bet_wins' => [],
|
||||
'user_streak_events' => [],
|
||||
'wallet_events' => [],
|
||||
'settled_order_count' => 0,
|
||||
];
|
||||
Db::startTrans();
|
||||
try {
|
||||
$settleOut = GameBetSettleService::settleBetsForDraw($recordId, $resultNumber);
|
||||
if ($pendingCount > 0) {
|
||||
$settleOut = GameBetSettleService::settleBetsForDraw($recordId, $resultNumber);
|
||||
}
|
||||
if ($status === 2) {
|
||||
if ($payoutUntil <= 0) {
|
||||
$payoutUntil = $now + self::getPayoutGraceSeconds();
|
||||
@@ -743,12 +756,14 @@ final class GameLiveService
|
||||
public static function tickAutoDraw(): void
|
||||
{
|
||||
if (!GameRecordService::isAutoCreateEnabled()) {
|
||||
$openCount = (int) Db::name('game_record')->whereIn('status', [0, 1])->count();
|
||||
if ($openCount <= 0) {
|
||||
return;
|
||||
}
|
||||
$record = Db::name('game_record')
|
||||
->whereIn('status', [0, 1])
|
||||
->order('id', 'asc')
|
||||
->find();
|
||||
$record = is_array($record) ? $record : null;
|
||||
} else {
|
||||
$record = self::resolveRecordForAutoDraw();
|
||||
}
|
||||
$record = self::resolveRecordForAutoDraw();
|
||||
if (!$record || !in_array((int) $record['status'], [0, 1], true)) {
|
||||
return;
|
||||
}
|
||||
@@ -804,7 +819,7 @@ final class GameLiveService
|
||||
}
|
||||
$reason = (string) __('Open period closed after payout: game is in maintenance');
|
||||
$rows = Db::name('game_record')
|
||||
->whereIn('status', [0, 1])
|
||||
->whereIn('status', [0, 1, 2])
|
||||
->order('id', 'asc')
|
||||
->select()
|
||||
->toArray();
|
||||
@@ -813,6 +828,18 @@ final class GameLiveService
|
||||
if ($rid === false || $rid <= 0) {
|
||||
continue;
|
||||
}
|
||||
$st = (int) ($row['status'] ?? -1);
|
||||
if ($st === 2) {
|
||||
Db::name('game_record')->where('id', $rid)->update([
|
||||
'status' => 5,
|
||||
'void_reason' => $reason,
|
||||
'pending_draw_number' => null,
|
||||
'payout_until' => null,
|
||||
'update_time' => time(),
|
||||
]);
|
||||
GameHotDataCoordinator::afterGameRecordCommitted($rid);
|
||||
continue;
|
||||
}
|
||||
self::voidOpenPeriodInternal($rid, $reason);
|
||||
}
|
||||
GameHotDataRedis::gameRecordRefreshAggregateCaches();
|
||||
|
||||
Reference in New Issue
Block a user