[], 'total' => 0, 'amount_cents' => 0]; $model = new WaterWithdrawalDemo(); if ($filters->source === 'regular' || !$model->getConnection()->getSchemaBuilder()->hasTable($model->getTable())) { return $empty; } $query = $model->newQuery() ->where('status', 'pending') ->whereBetween('created_at', [$filters->start->format('Y-m-d H:i:s'), $filters->end->format('Y-m-d H:i:s')]); $totals = (clone $query)->selectRaw('COUNT(*) AS total, COALESCE(SUM(amount_cents), 0) AS cents')->first(); $rows = $query->orderByDesc('created_at')->orderByDesc('id')->limit(20) ->get(['id', 'reference', 'applicant_name', 'kind_label', 'channel_label', 'amount_cents', 'created_at']) ->map(fn ($row) => $row->toArray() + ['is_demo' => true, 'status_label' => '待审核(测试)'])->all(); return ['list' => $rows, 'total' => (int)$totals->total, 'amount_cents' => (int)$totals->cents]; } }