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 === []) { if ($userIds === []) {
return []; return [];
} }
$rows = Db::name('user') // 兼容不同库结构:有的库没有 nickname 字段(仅 username
->whereIn('id', $userIds) try {
->field(['id', 'nickname', 'username']) $rows = Db::name('user')
->select() ->whereIn('id', $userIds)
->toArray(); ->field(['id', 'nickname', 'username'])
->select()
->toArray();
} catch (Throwable) {
$rows = Db::name('user')
->whereIn('id', $userIds)
->field(['id', 'username'])
->select()
->toArray();
}
$out = []; $out = [];
foreach ($rows as $row) { foreach ($rows as $row) {
$uid = isset($row['id']) && is_numeric($row['id']) ? (int) $row['id'] : 0; $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 !== '') { if ($periodNo !== '') {
$pid = Db::name('game_record')->where('period_no', $periodNo)->value('id'); $pid = Db::name('game_record')->where('period_no', $periodNo)->value('id');
$periodId = is_numeric((string) $pid) ? (int) $pid : 0; $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; echo "period_no={$periodNo} => period_id={$periodId}" . PHP_EOL;
} }
} }