feat(user-center): refine creator income details

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
kate522andClaude Fable 5 committed 2026-08-08 12:54:59 +08:00
1 parent bb6085b630
commit 77331979a7
2 files changed
+45 -8

No files matched your search

@@ -79,7 +79,7 @@ $currency_labels = [
<div><?php echo wp_kses_post($note); ?></div>
</section>
<section class="creator-income__details">
<section class="creator-income__details widget-card">
<div class="creator-income__toolbar">
<div>
<h2><?php esc_html_e('收入明细', 'aksrt'); ?></h2>
@@ -97,11 +97,37 @@ $currency_labels = [
$unit = (string) ($item['currency'] ?? 'CNY') === 'points' ? 'points' : 'CNY';
$status = (string) ($item['status'] ?? '') === 'pending' ? 'pending' : 'settled';
$amount = $format($item['amount'] ?? 0, $unit);
$order_number = trim((string) ($item['order_number'] ?? ''));
$order_number = $order_number !== '' ? $order_number : __('订单编号未知', 'aksrt');
$post = get_post((int) ($item['post_id'] ?? 0));
$source = $post instanceof WP_Post && $post->post_type === 'post'
? get_the_title($post)
: __('内容已删除', 'aksrt');
$source = trim((string) $source) !== '' ? (string) $source : __('内容已删除', 'aksrt');
$created_at = trim((string) ($item['created_at'] ?? ''));
$time_label = '';
$time_datetime = '';
if ($created_at !== '') {
try {
$created = new DateTimeImmutable($created_at, wp_timezone());
$time_datetime = $created->format('c');
$time_label = wp_date(get_option('date_format') . ' ' . get_option('time_format'), $created->getTimestamp());
} catch (Exception $exception) {
$time_label = '';
}
}
?>
<article class="creator-income-row" role="listitem">
<span class="creator-income-row__order" title="<?php echo esc_attr($order_number); ?>"><?php echo esc_html($order_number); ?></span>
<span class="creator-income-row__currency"><?php echo esc_html($currency_labels[$unit === 'points' ? 'points' : 'CNY']); ?></span>
<strong class="creator-income-row__amount">+<?php echo esc_html($amount . ($unit === 'points' ? __('积分', 'aksrt') : __('现金', 'aksrt'))); ?></strong>
<span class="creator-income-row__status creator-income-row__status--<?php echo esc_attr($status); ?>"><?php echo esc_html($status_labels[$status]); ?></span>
<span class="creator-income-row__source" title="<?php echo esc_attr($source); ?>"><?php echo esc_html($source); ?></span>
<span class="creator-income-row__detail">
<strong class="creator-income-row__amount">+<?php echo esc_html($amount . ($unit === 'points' ? __('积分', 'aksrt') : __('现金', 'aksrt'))); ?></strong>
<?php if ($time_label !== '') : ?>
<time class="creator-income-row__time" datetime="<?php echo esc_attr($time_datetime); ?>"><?php echo esc_html($time_label); ?></time>
<?php endif; ?>
<span class="creator-income-row__status creator-income-row__status--<?php echo esc_attr($status); ?>"><?php echo esc_html($status_labels[$status]); ?></span>
</span>
</article>
<?php endforeach; ?>
</div>