fix(payment): normalize revenue currency filters
This commit is contained in:
1 parent
50ac2119f1
commit
c16add0807
1 file changed
+9
-6
@@ -283,8 +283,9 @@ class Revenue {
|
|||||||
$where[] = 'status = %s';
|
$where[] = 'status = %s';
|
||||||
$params[] = $status;
|
$params[] = $status;
|
||||||
}
|
}
|
||||||
$currency = sanitize_key((string) ($args['currency'] ?? ''));
|
$currency = strtolower(sanitize_key((string) ($args['currency'] ?? '')));
|
||||||
if (in_array($currency, ['CNY', 'points'], true)) {
|
if (in_array($currency, ['cny', 'points'], true)) {
|
||||||
|
$currency = $currency === 'points' ? 'points' : 'CNY';
|
||||||
$where[] = 'currency = %s';
|
$where[] = 'currency = %s';
|
||||||
$params[] = $currency;
|
$params[] = $currency;
|
||||||
}
|
}
|
||||||
@@ -317,8 +318,9 @@ class Revenue {
|
|||||||
|
|
||||||
$where = 'author_id = %d';
|
$where = 'author_id = %d';
|
||||||
$params = [$user_id];
|
$params = [$user_id];
|
||||||
$currency = sanitize_key((string) ($args['currency'] ?? ''));
|
$currency = strtolower(sanitize_key((string) ($args['currency'] ?? '')));
|
||||||
if (in_array($currency, ['CNY', 'points'], true)) {
|
if (in_array($currency, ['cny', 'points'], true)) {
|
||||||
|
$currency = $currency === 'points' ? 'points' : 'CNY';
|
||||||
$where .= ' AND currency = %s';
|
$where .= ' AND currency = %s';
|
||||||
$params[] = $currency;
|
$params[] = $currency;
|
||||||
}
|
}
|
||||||
@@ -388,8 +390,9 @@ class Revenue {
|
|||||||
$where[] = 'post_id = %d';
|
$where[] = 'post_id = %d';
|
||||||
$params[] = $post_id;
|
$params[] = $post_id;
|
||||||
}
|
}
|
||||||
$currency = sanitize_key((string) ($args['currency'] ?? ''));
|
$currency = strtolower(sanitize_key((string) ($args['currency'] ?? '')));
|
||||||
if (in_array($currency, ['CNY', 'points'], true)) {
|
if (in_array($currency, ['cny', 'points'], true)) {
|
||||||
|
$currency = $currency === 'points' ? 'points' : 'CNY';
|
||||||
$where[] = 'currency = %s';
|
$where[] = 'currency = %s';
|
||||||
$params[] = $currency;
|
$params[] = $currency;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user