进行了一些小优化

This commit is contained in:
2026-08-25 06:58:09 +08:00
parent 9381d1ff53
commit e5df6fdaa7
4 changed files with 82 additions and 22 deletions
+11 -4
View File
@@ -369,10 +369,17 @@ trait OrderRepositoryAdmin {
$params[] = $user_id;
}
$payment_method = sanitize_key((string) ($args['payment_method'] ?? ''));
if ($payment_method !== '') {
$where[] = 'payment_method = %s';
$params[] = $payment_method;
if (array_key_exists('payment_methods', $args)) {
$payment_methods = array_values(array_unique(array_filter(array_map(
static fn($method): string => sanitize_key((string) $method),
(array) $args['payment_methods']
))));
if ($payment_methods === []) {
$where[] = '1 = 0';
} else {
$where[] = 'payment_method IN (' . implode(', ', array_fill(0, count($payment_methods), '%s')) . ')';
array_push($params, ...$payment_methods);
}
}
if ($search !== '') {