Move 288 types from global AKSRT_* + inc/classes manual requires into
namespace AKSRT\{Domain} under src/AKSRT/, wire composer.json psr-4,
and slim bootstrap to helpers/modules/hooks only. Split multi-class
widget/gateway files, update admin contract audit paths, and document
the layout in ADR/README.
77 lines
2.6 KiB
PHP
77 lines
2.6 KiB
PHP
<?php
|
|
/**
|
|
* User center credits: transaction log list.
|
|
*
|
|
* Expects extracted $context vars.
|
|
*
|
|
* @package AKSRT
|
|
*/
|
|
|
|
defined('ABSPATH') || exit;
|
|
?>
|
|
<div class="uc-transactions">
|
|
<div class="uc-transactions__header">
|
|
<h3 class="uc-transactions__title">
|
|
<i class="fas fa-list-ul" aria-hidden="true"></i>
|
|
<?php echo esc_html(sprintf(__('%s明细', 'aksrt'), $currency_name)); ?>
|
|
</h3>
|
|
</div>
|
|
<?php
|
|
$credits_page = max(1, isset($_GET['credits_page']) ? (int) $_GET['credits_page'] : 1);
|
|
if (class_exists('\AKSRT\Credits\Credits')) {
|
|
$log = \AKSRT\Credits\Credits::get_log(['user_id' => $user_id, 'page' => $credits_page, 'per_page' => 10]);
|
|
} else {
|
|
$log = ['items' => [], 'total' => 0];
|
|
}
|
|
if (!empty($log['items'])) :
|
|
?>
|
|
<div class="uc-transactions__list">
|
|
<?php foreach ($log['items'] as $row) :
|
|
$delta = (int) $row['delta'];
|
|
$delta_class = $delta >= 0 ? 'is-positive' : 'is-negative';
|
|
?>
|
|
<div class="uc-transactions__item">
|
|
<div class="uc-transactions__icon <?php echo esc_attr($delta_class); ?>">
|
|
<i class="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_credits_label((string) $row['reason'])); ?>
|
|
<?php if (!empty($row['remark'])) : ?>
|
|
<span class="uc-transactions__remark">(<?php echo esc_html((string) $row['remark']); ?>)</span>
|
|
<?php endif; ?>
|
|
</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 > 0 ? '+' : '') . $delta); ?>
|
|
</span>
|
|
<span class="uc-transactions__balance">
|
|
<?php
|
|
/* translators: %s: balance */
|
|
printf(esc_html__('余额 %s', 'aksrt'), esc_html((string) (int) $row['balance_after']));
|
|
?>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
<?php
|
|
$total_pages = (int) ceil((int) ($log['total'] ?? 0) / 10);
|
|
if ($total_pages > 1) {
|
|
aksrt_render_profile_pagination($total_pages, $credits_page, 'credits_page');
|
|
}
|
|
?>
|
|
<?php else : ?>
|
|
<div class="uc-transactions__empty">
|
|
<div class="uc-transactions__empty-icon">
|
|
<i class="fas fa-receipt" aria-hidden="true"></i>
|
|
</div>
|
|
<p><?php echo esc_html(sprintf(__('还没有任何%s流水', 'aksrt'), $currency_name)); ?></p>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|