Guard batch activate with explicit status filters and add safety valve test
This commit is contained in:
@@ -989,6 +989,16 @@ class PlatformOrderController extends Controller
|
||||
return redirect()->back()->with('warning', '当前筛选集合包含「对账不一致/退款不一致」订单,为避免带病同步,请先完成金额/状态治理(补回执/核对退款/修正状态)后再批量同步订阅。');
|
||||
}
|
||||
|
||||
// 防误操作(口径一致):当用户显式传入了 status/payment_status 时,要求口径至少锁定「已支付+已生效」
|
||||
// 说明:订阅详情页的批量同步入口会带 site_subscription_id + syncable_only=1,但未必显式带 status/payment_status。
|
||||
// 这里采用“仅在显式传参时校验”的策略,避免误伤订阅详情页的一键批量同步。
|
||||
$hasExplicitStatusFilters = ((string) ($filters['payment_status'] ?? '') !== '') || ((string) ($filters['status'] ?? '') !== '');
|
||||
if ($scope === 'filtered' && $hasExplicitStatusFilters) {
|
||||
if (($filters['payment_status'] ?? '') !== 'paid' || ($filters['status'] ?? '') !== 'activated') {
|
||||
return redirect()->back()->with('warning', '为避免误操作,请先在筛选条件中锁定「支付状态=已支付」且「订单状态=已生效」,再执行批量同步订阅。');
|
||||
}
|
||||
}
|
||||
|
||||
// 防误操作:scope=all 需要二次确认
|
||||
if ($scope === 'all' && (string) $request->input('confirm', '') !== 'YES') {
|
||||
return redirect()->back()->with('warning', '为避免误操作,执行全量批量同步前请在确认框输入 YES。');
|
||||
|
||||
Reference in New Issue
Block a user