1.修复游戏实时对局/admin/game/live页面的报错

This commit is contained in:
2026-05-26 13:58:07 +08:00
parent 40247af0d6
commit 24f30b5ef2
3 changed files with 75 additions and 6 deletions

View File

@@ -261,6 +261,15 @@ final class GameLiveService
public static function buildSnapshot(?int $recordId = null): array
{
$record = self::resolveRecord($recordId);
if ($record) {
$periodSeconds = self::getConfigInt(self::KEY_PERIOD_SECONDS, 30);
GameHotDataRedis::gameRecordRevalidateFromDbIfStale($record, $periodSeconds);
$record = self::resolveRecord($recordId);
}
if ($record && GameHotDataRedis::isExpiredPayoutRecord($record)) {
self::finalizePayoutGrace();
$record = self::resolveRecord($recordId);
}
if (!$record) {
return self::emptySnapshotPayload();
}
@@ -684,10 +693,14 @@ final class GameLiveService
'payout_until' => null,
'update_time' => time(),
]);
GameRecordService::createNextRecordAfterDraw();
if (GameRecordService::isLiveRuntimeEnabled()) {
GameRecordService::createNextRecordRow();
}
Db::commit();
} catch (Throwable) {
} catch (Throwable $e) {
Db::rollback();
Log::warning('finalizePayoutGrace failed: ' . $e->getMessage(), ['record_id' => $id]);
return;
}
GameHotDataCoordinator::afterGameRecordCommitted($id);
@@ -915,12 +928,15 @@ final class GameLiveService
if ($payoutUntil === false || $payoutUntil <= 0) {
return;
}
$now = time();
if ($payoutUntil <= $now) {
return;
}
$periodId = filter_var($record['id'] ?? 0, FILTER_VALIDATE_INT);
if ($periodId === false) {
$periodId = 0;
}
$periodNo = is_string($record['period_no'] ?? null) ? (string) $record['period_no'] : '';
$now = time();
$resultNumber = null;
$resultParsed = filter_var($record['result_number'] ?? null, FILTER_VALIDATE_INT);
if ($resultParsed !== false && $resultParsed > 0) {