utc(); $batchCounts = [ 'total' => $draw->resultBatches()->count(), 'pending_review' => $draw->resultBatches() ->where('status', DrawResultBatchStatus::PendingReview->value) ->count(), 'published' => $draw->resultBatches() ->where('status', DrawResultBatchStatus::Published->value) ->count(), ]; return ApiResponse::success([ 'id' => (int) $draw->id, 'draw_no' => $draw->draw_no, 'business_date' => $draw->business_date instanceof Carbon ? $draw->business_date->format('Y-m-d') : (string) $draw->business_date, 'sequence_no' => (int) $draw->sequence_no, /** 数据库当期状态(权威) */ 'status' => $draw->status, /** 与玩家大厅 snapshot 对齐的展示态(未跑 tick 时可能与 status 不一致) */ 'hall_preview_status' => $this->hallPreview->effectiveHallDisplayStatus($draw, $nowUtc), 'start_time' => $draw->start_time?->toIso8601String(), 'close_time' => $draw->close_time?->toIso8601String(), 'draw_time' => $draw->draw_time?->toIso8601String(), 'cooling_end_time' => $draw->cooling_end_time?->toIso8601String(), 'result_source' => $draw->result_source, 'current_result_version' => (int) $draw->current_result_version, 'settle_version' => (int) $draw->settle_version, 'is_reopened' => (bool) $draw->is_reopened, 'created_at' => $draw->created_at?->toIso8601String(), 'updated_at' => $draw->updated_at?->toIso8601String(), 'result_batch_counts' => $batchCounts, ]); } }