Files
wordpress-theme-aksrt/inc/helpers/user-center-renderers/credits-wallet-ledger.php
T
kate522 32e76b440f fix(frontend): 用户中心余额与积分记录不再拼接括号内容
记录行只保留中文变动原因、时间与变动额,移除名称后的(引用键/备注/提现单号)拼接。

同步清理该改动产生的死代码:$record_note 计算块、.uc-transactions__remark 样式、LedgerQuery 中已无消费者的 financial_flow LEFT JOIN 与 withdrawal_number 字段,以及 credits-wallet.php 里恒为 true 的 $skip_wallet_ledger 双路分支。
2026-09-19 11:46:01 +08:00

65 lines
2.3 KiB
PHP

<?php
/**
* User center balance transaction list.
*
* Expects extracted $context vars.
*
* @package AKSRT
*/
defined('ABSPATH') || exit;
$asset_request = is_array($asset_request ?? null) ? $asset_request : [];
$wallet_page = ($asset_request['asset'] ?? '') === 'balance'
? max(1, (int) ($asset_request['page'] ?? 1))
: 1;
$wlog = \AKSRT\Ledger\LedgerQuery::get_instance()->history([
'user_id' => (int) ($user_id ?? 0),
'asset' => 'balance',
'page' => $wallet_page,
'per_page' => 10,
]);
?>
<div class="uc-transactions uc-transactions--wallet">
<div class="uc-transactions__header">
<h3 class="uc-transactions__title">
<i class="fa fas fa-list-ul" aria-hidden="true"></i>
<?php esc_html_e('余额记录', 'aksrt'); ?>
</h3>
</div>
<?php if (!empty($wlog['items'])) : ?>
<div class="uc-transactions__list">
<?php foreach ($wlog['items'] as $row) :
$delta = (int) $row['delta_minor'];
$delta_class = $delta >= 0 ? 'is-positive' : 'is-negative';
$delta_txt = ($delta > 0 ? '+' : '-') . \AKSRT\Ledger\AssetAmount::from_minor(\AKSRT\Ledger\AssetType::BALANCE, abs($delta))->formatted();
?>
<div class="uc-transactions__item">
<div class="uc-transactions__icon <?php echo esc_attr($delta_class); ?>">
<i class="fa fas fa-<?php echo $delta >= 0 ? 'arrow-up' : 'arrow-down'; ?>" aria-hidden="true"></i>
</div>
<div class="uc-transactions__info">
<div class="uc-transactions__reason">
<?php echo esc_html(aksrt_asset_reason_label((string) $row['reason'])); ?>
</div>
<div class="uc-transactions__time"><?php echo esc_html(get_date_from_gmt((string) $row['created_at'], 'Y-m-d H:i')); ?></div>
</div>
<div class="uc-transactions__amount">
<span class="uc-transactions__delta <?php echo esc_attr($delta_class); ?>"><?php echo esc_html($delta_txt); ?></span>
</div>
</div>
<?php endforeach; ?>
</div>
<?php
$total_pages = (int) ceil((int) ($wlog['total'] ?? 0) / 10);
if ($total_pages > 1 && function_exists('aksrt_render_asset_pagination')) {
aksrt_render_asset_pagination($total_pages, $wallet_page, 'balance');
}
?>
<?php else : ?>
<div class="uc-transactions__empty">
<p><?php esc_html_e('还没有任何余额流水', 'aksrt'); ?></p>
</div>
<?php endif; ?>
</div>