feat(payment): separate creator income settlement

This commit is contained in:
2026-08-07 12:39:32 +08:00
parent cd93ea1656
commit e20418e909
17 changed files with 451 additions and 445 deletions
+14 -7
View File
@@ -51,12 +51,16 @@ class PayIncome {
$svc = \AKSRT\Payment\Revenue::get_instance();
$stats = $user_id > 0 ? $svc->get_stats($user_id) : $svc->get_stats();
$cash_stats = (array) ($stats['cash'] ?? []);
$points_stats = (array) ($stats['points'] ?? []);
echo '<p>' . esc_html(sprintf(
/* translators: 1: total 2: pending 3: settled */
__('合计 %1$s · 待结算 %2$s · 已结算 %3$s', 'aksrt'),
number_format((float) ($stats['total'] ?? 0), 2),
number_format((float) ($stats['pending'] ?? 0), 2),
number_format((float) ($stats['settled'] ?? 0), 2)
__('现金:合计 ¥%1$s · 待结算 ¥%2$s · 已结算 ¥%3$s;积分:合计 %4$s · 待结算 %5$s · 已结算 %6$s', 'aksrt'),
number_format((float) ($cash_stats['total'] ?? 0), 2),
number_format((float) ($cash_stats['pending'] ?? 0), 2),
number_format((float) ($cash_stats['settled'] ?? 0), 2),
number_format((float) ($points_stats['total'] ?? 0), 0),
number_format((float) ($points_stats['pending'] ?? 0), 0),
number_format((float) ($points_stats['settled'] ?? 0), 0)
)) . '</p>';
echo '<form id="aksrt-pay-batch-settle-income" method="post" action="' . esc_url(admin_url('admin-post.php')) . '" style="margin:12px 0;">';
@@ -68,7 +72,7 @@ class PayIncome {
echo '<form method="get" style="margin:12px 0;">';
echo '<input type="hidden" name="page" value="aksrt_income" />';
echo '<select name="status">';
foreach (['' => __('全部状态', 'aksrt'), 'pending' => __('待结算', 'aksrt'), 'settled' => __('已结算', 'aksrt'), 'cancelled' => __('已取消', 'aksrt'), 'reversed' => __('已冲正', 'aksrt'), 'pending_recovery' => __('待追缴', 'aksrt')] as $key => $label) {
foreach (['' => __('全部状态', 'aksrt'), 'pending' => __('待结算', 'aksrt'), 'settled' => __('已结算', 'aksrt')] as $key => $label) {
printf('<option value="%s"%s>%s</option>', esc_attr($key), selected($status, $key, false), esc_html($label));
}
echo '</select> ';
@@ -116,7 +120,10 @@ class PayIncome {
echo '<td>' . ($st === 'pending' ? '<input type="checkbox" form="aksrt-pay-batch-settle-income" name="revenue_ids[]" value="' . esc_attr((string) $id) . '" />' : '') . '</td>';
echo '<td>' . esc_html((string) $id) . '</td><td>' . ($user ? esc_html($user->display_name) : esc_html((string) $user_id)) . '</td>';
echo '<td><code>' . esc_html((string) ($row['order_number'] ?? '')) . '</code></td>';
echo '<td>' . esc_html(number_format((float) ($row['amount'] ?? 0), 2)) . '</td>';
$is_points = (string) ($row['currency'] ?? 'CNY') === 'points';
$row_currency = $is_points ? __('积分', 'aksrt') : '¥';
$row_decimals = $is_points ? 0 : 2;
echo '<td>' . esc_html(number_format((float) ($row['amount'] ?? 0), $row_decimals) . ' ' . $row_currency) . '</td>';
echo '<td>' . esc_html($st) . '</td>';
echo '<td>' . esc_html((string) ($row['created_at'] ?? '')) . '</td>';
echo '<td>';