From 257b5327577a68e399b624dde04c8fe6bca88287 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Sun, 15 Mar 2026 18:51:59 +0800 Subject: [PATCH] =?UTF-8?q?feat(admin):=20=E4=BB=AA=E8=A1=A8=E7=9B=98?= =?UTF-8?q?=E6=8E=A5=E5=85=A5=E6=9C=80=E8=BF=91=E5=B9=B3=E5=8F=B0=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E5=88=97=E8=A1=A8=EF=BC=88=E6=94=B6=E8=B4=B9=E9=97=AD?= =?UTF-8?q?=E7=8E=AF=E5=85=A5=E5=8F=A3=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/Admin/DashboardController.php | 24 ++++++++++++ resources/views/admin/dashboard.blade.php | 39 +++++++++++++++++-- 2 files changed, 60 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/Admin/DashboardController.php b/app/Http/Controllers/Admin/DashboardController.php index 3a3bded..59b11d8 100644 --- a/app/Http/Controllers/Admin/DashboardController.php +++ b/app/Http/Controllers/Admin/DashboardController.php @@ -8,6 +8,7 @@ use App\Models\Admin; use App\Models\Order; use App\Models\Product; use App\Models\Merchant; +use App\Models\PlatformOrder; use App\Models\User; use App\Support\CacheKeys; use Illuminate\Http\Request; @@ -31,14 +32,37 @@ class DashboardController extends Controller 'users' => User::count(), 'products' => Product::count(), 'orders' => Order::count(), + + // 收费中心(平台侧) + 'platform_orders' => PlatformOrder::count(), + 'platform_orders_unpaid_pending' => PlatformOrder::query() + ->where('payment_status', 'unpaid') + ->where('status', 'pending') + ->count(), + 'platform_orders_paid_pending' => PlatformOrder::query() + ->where('payment_status', 'paid') + ->where('status', 'pending') + ->count(), + // 同步失败:沿用平台订单列表口径(meta.subscription_activation_error.message 存在即失败) + 'platform_orders_sync_failed' => PlatformOrder::query() + ->whereRaw("JSON_EXTRACT(meta, '$.subscription_activation_error.message') IS NOT NULL") + ->count(), + + // 站点治理 'active_merchants' => Merchant::query()->where('status', 'active')->count(), 'pending_orders' => Order::query()->where('status', 'pending')->count(), ] ); + $recentPlatformOrders = PlatformOrder::query() + ->orderByDesc('id') + ->limit(5) + ->get(); + return view('admin.dashboard', [ 'adminName' => $admin->name, 'stats' => $stats, + 'recentPlatformOrders' => $recentPlatformOrders, 'platformAdmin' => $admin, 'cacheMeta' => [ 'store' => config('cache.default'), diff --git a/resources/views/admin/dashboard.blade.php b/resources/views/admin/dashboard.blade.php index aed2809..7e6abcb 100644 --- a/resources/views/admin/dashboard.blade.php +++ b/resources/views/admin/dashboard.blade.php @@ -112,9 +112,42 @@
-

最近平台订单(占位)

-
后续接入:最近 N 笔平台订单列表(订单号/站点/套餐/金额/状态/同步状态)。
-
说明:先保证“看板位”稳定,避免后续接数据时反复改版。
+
+

最近平台订单

+ 查看全部 +
+ + + + + + + + + + + + + @forelse(($recentPlatformOrders ?? []) as $po) + @php + $poShowUrl = '/admin/platform-orders/' . $po->id; + @endphp + + + + + + + + @empty + + + + @endforelse + +
订单号类型金额支付状态
{{ $po->order_no }}{{ $po->orderTypeLabel() }}¥{{ number_format((float) $po->payable_amount, 2) }}{{ $po->payment_status }}{{ $po->status }}
暂无数据
+ +
说明:当前先接入最近订单列表;后续补“同步状态/站点/套餐/治理入口”。