diff --git a/app/Http/Controllers/Admin/PlatformOrderController.php b/app/Http/Controllers/Admin/PlatformOrderController.php index df2f837..2876c30 100644 --- a/app/Http/Controllers/Admin/PlatformOrderController.php +++ b/app/Http/Controllers/Admin/PlatformOrderController.php @@ -2098,9 +2098,14 @@ class PlatformOrderController extends Controller }) ->when(($filters['syncable_only'] ?? '') !== '', function (Builder $builder) { // 只看可同步:已支付 + 已生效 + 尚未写入 subscription_activation.subscription_id + // 额外治理口径:排除(续费但未绑定订阅)的脏数据,避免误入可同步集合导致串单风险 $builder->where('payment_status', 'paid') ->where('status', 'activated') - ->whereRaw("JSON_EXTRACT(meta, '$.subscription_activation.subscription_id') IS NULL"); + ->whereRaw("JSON_EXTRACT(meta, '$.subscription_activation.subscription_id') IS NULL") + ->where(function (Builder $q) { + $q->where('order_type', '!=', 'renewal') + ->orWhereNotNull('site_subscription_id'); + }); }) ->when(($filters['batch_synced_24h'] ?? '') !== '', function (Builder $builder) { // 只看最近 24 小时批量同步过的订单(基于 meta.batch_activation.at)