1.优化websocket中的jackpot.hit

This commit is contained in:
2026-05-28 17:28:51 +08:00
parent c49db7ca93
commit 3e5858bcce
2 changed files with 19 additions and 5 deletions

View File

@@ -763,11 +763,20 @@ final class GameBetSettleService
if ($userIds === []) {
return [];
}
$rows = Db::name('user')
->whereIn('id', $userIds)
->field(['id', 'nickname', 'username'])
->select()
->toArray();
// 兼容不同库结构:有的库没有 nickname 字段(仅 username
try {
$rows = Db::name('user')
->whereIn('id', $userIds)
->field(['id', 'nickname', 'username'])
->select()
->toArray();
} catch (Throwable) {
$rows = Db::name('user')
->whereIn('id', $userIds)
->field(['id', 'username'])
->select()
->toArray();
}
$out = [];
foreach ($rows as $row) {
$uid = isset($row['id']) && is_numeric($row['id']) ? (int) $row['id'] : 0;

View File

@@ -26,6 +26,11 @@ if ($periodId <= 0 && isset($opts['period-no'])) {
if ($periodNo !== '') {
$pid = Db::name('game_record')->where('period_no', $periodNo)->value('id');
$periodId = is_numeric((string) $pid) ? (int) $pid : 0;
if ($periodId <= 0) {
// 兜底:部分环境 game_record.period_no 与 bet_order.period_no 不一致(或 game_record 未落库),从注单反查 period_id
$pid2 = Db::name('bet_order')->where('period_no', $periodNo)->value('period_id');
$periodId = is_numeric((string) $pid2) ? (int) $pid2 : 0;
}
echo "period_no={$periodNo} => period_id={$periodId}" . PHP_EOL;
}
}