fix(user-center): close creator income review gaps

This commit is contained in:
kate522 committed 2026-08-07 13:16:10 +08:00
1 parent c16add0807
commit cfb0a1368c
6 files changed
+56 -62

No files matched your search

+14 -1
View File
@@ -40,14 +40,21 @@ class PayIncome {
}
$status = isset($_GET['status']) ? sanitize_key((string) wp_unslash($_GET['status'])) : '';
$order_status = isset($_GET['order_status']) ? sanitize_key((string) wp_unslash($_GET['order_status'])) : '';
$user_id = isset($_GET['user_id']) ? max(0, (int) $_GET['user_id']) : 0;
$post_id = isset($_GET['post_id']) ? max(0, (int) $_GET['post_id']) : 0;
$currency = isset($_GET['currency']) ? sanitize_key((string) wp_unslash($_GET['currency'])) : '';
$currency = isset($_GET['currency']) ? strtolower(sanitize_key((string) wp_unslash($_GET['currency']))) : '';
if ($currency === 'cny') {
$currency = 'CNY';
}
$order_number = isset($_GET['order_number']) ? sanitize_text_field((string) wp_unslash($_GET['order_number'])) : '';
$date_from = isset($_GET['date_from']) ? sanitize_text_field((string) wp_unslash($_GET['date_from'])) : '';
$date_to = isset($_GET['date_to']) ? sanitize_text_field((string) wp_unslash($_GET['date_to'])) : '';
$page_num = max(1, (int) ($_GET['paged'] ?? 1));
$per_page = 20;
$order_statuses = class_exists('\\AKSRT\\Payment\\Order')
? \AKSRT\Payment\Order::get_valid_statuses()
: [];
$svc = \AKSRT\Payment\Revenue::get_instance();
$stats = $user_id > 0 ? $svc->get_stats($user_id) : $svc->get_stats();
@@ -76,6 +83,11 @@ class PayIncome {
printf('<option value="%s"%s>%s</option>', esc_attr($key), selected($status, $key, false), esc_html($label));
}
echo '</select> ';
echo '<select name="order_status"><option value="">' . esc_html__('全部订单状态', 'aksrt') . '</option>';
foreach ((array) $order_statuses as $key => $label) {
printf('<option value="%s"%s>%s</option>', esc_attr($key), selected($order_status, $key, false), esc_html($label));
}
echo '</select> ';
echo '<input type="number" min="0" name="user_id" value="' . esc_attr($user_id > 0 ? (string) $user_id : '') . '" placeholder="' . esc_attr__('用户 ID', 'aksrt') . '" class="small-text" /> ';
echo '<input type="number" min="0" name="post_id" value="' . esc_attr($post_id > 0 ? (string) $post_id : '') . '" placeholder="' . esc_attr__('文章 ID', 'aksrt') . '" class="small-text" /> ';
echo '<select name="currency"><option value="">' . esc_html__('全部货币', 'aksrt') . '</option><option value="CNY"' . selected($currency, 'CNY', false) . '>CNY</option><option value="points"' . selected($currency, 'points', false) . '>' . esc_html__('积分', 'aksrt') . '</option></select> ';
@@ -89,6 +101,7 @@ class PayIncome {
$list_args = [
'status' => $status,
'order_status' => $order_status,
'limit' => $per_page,
'offset' => ($page_num - 1) * $per_page,
'post_id' => $post_id,
+1
View File
@@ -254,6 +254,7 @@ class PaymentController extends ControllerBase {
'user_id' => max(0, (int) $request->get_param('user_id')),
'post_id' => max(0, (int) $request->get_param('post_id')),
'currency' => sanitize_key((string) $request->get_param('currency')),
'order_status' => sanitize_key((string) $request->get_param('order_status')),
'order_number' => sanitize_text_field((string) $request->get_param('order_number')),
'date_from' => sanitize_text_field((string) $request->get_param('date_from')),
'date_to' => sanitize_text_field((string) $request->get_param('date_to')),
+9
View File
@@ -396,6 +396,15 @@ class Revenue {
$where[] = 'currency = %s';
$params[] = $currency;
}
$order_status = sanitize_key((string) ($args['order_status'] ?? ''));
$valid_order_statuses = class_exists('\\AKSRT\\Core\\DomainModel')
? \AKSRT\Core\DomainModel::order_status_labels()
: [];
$orders_table = \AKSRT\Core\DBMigrator::table('order');
if ($orders_table !== '' && isset($valid_order_statuses[$order_status])) {
$where[] = "EXISTS (SELECT 1 FROM {$orders_table} AS income_order WHERE income_order.order_number = {$this->table()}.order_number AND income_order.status = %s)";
$params[] = $order_status;
}
$order_number = sanitize_text_field((string) ($args['order_number'] ?? ''));
if ($order_number !== '') {
$where[] = 'order_number LIKE %s';
+8 -11
View File
@@ -116,7 +116,7 @@ class Center {
$settings = class_exists('\AKSRT\Settings\Settings')
? \AKSRT\Settings\Settings::get_user_center_settings()
: [
'tabs' => ['profile', 'posts', 'comments', 'favorites'],
'tabs' => ['profile', 'comments', 'favorites'],
'avatar_upload' => true,
'cover_upload' => true,
'social_links' => true,
@@ -135,12 +135,6 @@ class Center {
'priority' => 15,
'type' => 'panel',
],
'posts' => [
'label' => __('我的文章', 'aksrt'),
'icon' => 'file-alt',
'priority' => 20,
'type' => 'panel',
],
'creator' => [
'label' => __('创作中心', 'aksrt'),
'icon' => 'feather-alt',
@@ -206,9 +200,12 @@ class Center {
];
$this->panels = [];
$configured = array_values(array_filter(array_map('sanitize_key', (array) ($settings['tabs'] ?? []))));
$configured = array_values(array_filter(
array_map('sanitize_key', (array) ($settings['tabs'] ?? [])),
static fn(string $key): bool => $key !== 'posts'
));
if ($configured === []) {
$configured = ['profile', 'posts', 'comments', 'favorites'];
$configured = ['profile', 'comments', 'favorites'];
}
$level_on = class_exists('\AKSRT\User\Level')
@@ -246,7 +243,7 @@ class Center {
if ($vip_on && !in_array('vip', $order, true)) {
$insert_at = count($order);
foreach (['credits', 'favorites', 'posts'] as $anchor) {
foreach (['credits', 'favorites'] as $anchor) {
$idx = array_search($anchor, $order, true);
if ($idx !== false) {
$insert_at = (int) $idx + 1;
@@ -278,7 +275,7 @@ class Center {
if ($revenue_tab_on && !in_array('revenue', $order, true)) {
$insert_at = count($order);
foreach (['credits', 'favorites', 'posts'] as $anchor) {
foreach (['credits', 'favorites'] as $anchor) {
$idx = array_search($anchor, $order, true);
if ($idx !== false) {
$insert_at = (int) $idx + 1;