feat(admin): 仪表盘可同步入口显示计数(口径对齐平台订单)

This commit is contained in:
萝卜
2026-03-15 19:53:24 +08:00
parent 0a5b86ac55
commit 452ac450c8
3 changed files with 70 additions and 1 deletions

View File

@@ -58,6 +58,17 @@ class DashboardController extends Controller
// 口径对齐“待生效”语义:排除明确的同步失败(失败单应该去同步失败治理)
->whereRaw("JSON_EXTRACT(meta, '$.subscription_activation_error.message') IS NULL")
->count(),
// 可同步沿用平台订单列表口径paid+activated+未同步+无失败),且排除续费缺订阅脏数据
'platform_orders_syncable' => PlatformOrder::query()
->where('payment_status', 'paid')
->where('status', 'activated')
->whereRaw("JSON_EXTRACT(meta, '$.subscription_activation.subscription_id') IS NULL")
->whereRaw("JSON_EXTRACT(meta, '$.subscription_activation_error.message') IS NULL")
->where(function ($q) {
$q->where('order_type', '!=', 'renewal')
->orWhereNotNull('site_subscription_id');
})
->count(),
// 同步失败沿用平台订单列表口径meta.subscription_activation_error.message 存在即失败)
'platform_orders_sync_failed' => PlatformOrder::query()
->whereRaw("JSON_EXTRACT(meta, '$.subscription_activation_error.message') IS NOT NULL")