chore(governance): batch mark activated requires unsynced scope
This commit is contained in:
@@ -1818,11 +1818,15 @@ class PlatformOrderController extends Controller
|
|||||||
'refund_inconsistent' => (string) $request->input('refund_inconsistent', ''),
|
'refund_inconsistent' => (string) $request->input('refund_inconsistent', ''),
|
||||||
];
|
];
|
||||||
|
|
||||||
// 防误操作:批量“仅标记为已生效”默认要求当前筛选口径为「已支付 + 待处理(pending)」
|
// 防误操作:批量“仅标记为已生效”默认要求当前筛选口径为「已支付 + 待处理(pending) + 未同步(unsynced)」
|
||||||
if ($scope === 'filtered') {
|
if ($scope === 'filtered') {
|
||||||
if (($filters['payment_status'] ?? '') !== 'paid' || ($filters['status'] ?? '') !== 'pending') {
|
if (($filters['payment_status'] ?? '') !== 'paid' || ($filters['status'] ?? '') !== 'pending') {
|
||||||
return redirect()->back()->with('warning', '为避免误操作,请先筛选「支付状态=已支付」且「订单状态=待处理」,再执行批量仅标记为已生效。');
|
return redirect()->back()->with('warning', '为避免误操作,请先筛选「支付状态=已支付」且「订单状态=待处理」,再执行批量仅标记为已生效。');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (($filters['sync_status'] ?? '') !== 'unsynced') {
|
||||||
|
return redirect()->back()->with('warning', '为避免把同步失败等异常单混入,请先锁定「同步状态=未同步(sync_status=unsynced)」(建议用快捷筛选「待生效」)再执行批量仅标记为已生效。');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 防误操作:scope=all 需要二次确认
|
// 防误操作:scope=all 需要二次确认
|
||||||
|
|||||||
@@ -87,6 +87,11 @@ class PlatformOrderToolsGuard
|
|||||||
return '请先筛选「支付状态=已支付」且「订单状态=待处理」再执行批量生效。';
|
return '请先筛选「支付状态=已支付」且「订单状态=待处理」再执行批量生效。';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 待生效口径一致:paid + pending + unsynced(排除同步失败等异常单),避免误把失败单“批量生效”导致治理链路混乱。
|
||||||
|
if ((string) ($filters['sync_status'] ?? '') !== 'unsynced') {
|
||||||
|
return '为避免把同步失败等异常单混入,请先锁定「同步状态=未同步(sync_status=unsynced)」(建议用快捷筛选「待生效」)再执行批量生效。';
|
||||||
|
}
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -97,6 +97,7 @@ class AdminPlatformOrderBatchMarkActivatedTest extends TestCase
|
|||||||
'scope' => 'filtered',
|
'scope' => 'filtered',
|
||||||
'payment_status' => 'paid',
|
'payment_status' => 'paid',
|
||||||
'status' => 'pending',
|
'status' => 'pending',
|
||||||
|
'sync_status' => 'unsynced',
|
||||||
'limit' => 50,
|
'limit' => 50,
|
||||||
])->assertRedirect();
|
])->assertRedirect();
|
||||||
|
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ class AdminPlatformOrderIndexBatchButtonsShouldEnableWhenFiltersMatchTest extend
|
|||||||
'meta' => [],
|
'meta' => [],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$res = $this->get('/admin/platform-orders?status=pending&payment_status=paid');
|
$res = $this->get('/admin/platform-orders?status=pending&payment_status=paid&sync_status=unsynced');
|
||||||
$res->assertOk();
|
$res->assertOk();
|
||||||
|
|
||||||
$html = (string) $res->getContent();
|
$html = (string) $res->getContent();
|
||||||
|
|||||||
Reference in New Issue
Block a user