1.优化websocket中的jackpot.hit

2.优化/api/game/betMyOrders接口,新增中奖号码字段result_number
This commit is contained in:
2026-05-28 17:13:59 +08:00
parent c3ac33ec3d
commit 99df6b378a
7 changed files with 118 additions and 2 deletions

View File

@@ -401,8 +401,40 @@ class Game extends MobileBase
'list_rows' => $pageSize,
]);
$periodIds = [];
foreach ($paginate->items() as $item) {
$periodIdValue = filter_var($item->period_id ?? null, FILTER_VALIDATE_INT);
if ($periodIdValue !== false && $periodIdValue > 0) {
$periodIds[] = $periodIdValue;
}
}
$periodIds = array_values(array_unique($periodIds));
$resultNumberByPeriodId = [];
if ($periodIds !== []) {
$periodRows = Db::name('game_record')
->whereIn('id', $periodIds)
->field(['id', 'result_number'])
->select()
->toArray();
foreach ($periodRows as $row) {
if (!is_array($row)) {
continue;
}
$pid = filter_var($row['id'] ?? null, FILTER_VALIDATE_INT);
if ($pid === false || $pid <= 0) {
continue;
}
$rn = filter_var($row['result_number'] ?? null, FILTER_VALIDATE_INT);
$resultNumberByPeriodId[$pid] = ($rn === false ? null : $rn);
}
}
$rows = [];
foreach ($paginate->items() as $item) {
$periodIdValue = filter_var($item->period_id ?? null, FILTER_VALIDATE_INT);
if ($periodIdValue === false) {
$periodIdValue = 0;
}
$rows[] = [
'order_no' => (string) $item->id,
'period_no' => $item->period_no,
@@ -410,7 +442,7 @@ class Game extends MobileBase
// 整笔压注金额(本笔总扣款)
'bet_amount' => $item->total_amount,
'total_amount' => $item->total_amount,
'result_number' => null,
'result_number' => $periodIdValue > 0 ? ($resultNumberByPeriodId[$periodIdValue] ?? null) : null,
'win_amount' => $item->win_amount,
'status' => (string) $item->status,
'create_time' => $item->create_time,