platform orders: add 24h batch BMPA summary stat and card

This commit is contained in:
萝卜
2026-03-13 14:03:54 +00:00
parent a926acb7c9
commit 96e9b67f64
3 changed files with 116 additions and 0 deletions

View File

@@ -310,6 +310,21 @@ class PlatformOrderController extends Controller
return $q->count();
})(),
'batch_mark_paid_and_activate_24h_orders' => (function () use ($baseQuery) {
$since = now()->subHours(24)->format('Y-m-d H:i:s');
$q = (clone $baseQuery)
->whereRaw("JSON_EXTRACT(meta, '$.batch_mark_paid_and_activate.at') IS NOT NULL");
$driver = $q->getQuery()->getConnection()->getDriverName();
if ($driver === 'sqlite') {
$q->whereRaw("JSON_EXTRACT(meta, '$.batch_mark_paid_and_activate.at') >= ?", [$since]);
} else {
$q->whereRaw("JSON_UNQUOTE(JSON_EXTRACT(meta, '$.batch_mark_paid_and_activate.at')) >= ?", [$since]);
}
return $q->count();
})(),
'batch_mark_activated_24h_orders' => (function () use ($baseQuery) {
$since = now()->subHours(24)->format('Y-m-d H:i:s');