platform orders: syncable_only filter excludes renewal missing subscription
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user