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; }