From c16add08076edb27c91cf5a686cab549be85e368 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 7 Aug 2026 12:53:57 +0800 Subject: [PATCH] fix(payment): normalize revenue currency filters --- src/Payment/Revenue.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/Payment/Revenue.php b/src/Payment/Revenue.php index 8a8a3ab7..f575e10e 100644 --- a/src/Payment/Revenue.php +++ b/src/Payment/Revenue.php @@ -283,8 +283,9 @@ class Revenue { $where[] = 'status = %s'; $params[] = $status; } - $currency = sanitize_key((string) ($args['currency'] ?? '')); - if (in_array($currency, ['CNY', 'points'], true)) { + $currency = strtolower(sanitize_key((string) ($args['currency'] ?? ''))); + if (in_array($currency, ['cny', 'points'], true)) { + $currency = $currency === 'points' ? 'points' : 'CNY'; $where[] = 'currency = %s'; $params[] = $currency; } @@ -317,8 +318,9 @@ class Revenue { $where = 'author_id = %d'; $params = [$user_id]; - $currency = sanitize_key((string) ($args['currency'] ?? '')); - if (in_array($currency, ['CNY', 'points'], true)) { + $currency = strtolower(sanitize_key((string) ($args['currency'] ?? ''))); + if (in_array($currency, ['cny', 'points'], true)) { + $currency = $currency === 'points' ? 'points' : 'CNY'; $where .= ' AND currency = %s'; $params[] = $currency; } @@ -388,8 +390,9 @@ class Revenue { $where[] = 'post_id = %d'; $params[] = $post_id; } - $currency = sanitize_key((string) ($args['currency'] ?? '')); - if (in_array($currency, ['CNY', 'points'], true)) { + $currency = strtolower(sanitize_key((string) ($args['currency'] ?? ''))); + if (in_array($currency, ['cny', 'points'], true)) { + $currency = $currency === 'points' ? 'points' : 'CNY'; $where[] = 'currency = %s'; $params[] = $currency; }