fix(payment): normalize revenue currency filters
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user