feat(payment): rebuild order details and asset records
This commit is contained in:
1 parent
476e2f961d
commit
7b55cfb190
57 files changed
+2080
-1294
No files matched your search
@@ -21,12 +21,14 @@ defined('ABSPATH') || exit;
|
||||
$credits_page = ($asset_request['asset'] ?? '') === 'points'
|
||||
? max(1, (int) ($asset_request['page'] ?? 1))
|
||||
: 1;
|
||||
$log = \AKSRT\Ledger\LedgerQuery::get_instance()->history(['user_id' => $user_id, 'asset' => 'points', 'page' => $credits_page, 'per_page' => 10]);
|
||||
if (!empty($log['items'])) :
|
||||
$history = get_user_meta((int) $user_id, 'points_record', true);
|
||||
$history = is_array($history) ? array_slice($history, 0, 50) : [];
|
||||
$items = array_slice($history, ($credits_page - 1) * 10, 10);
|
||||
if ($items) :
|
||||
?>
|
||||
<div class="uc-transactions__list">
|
||||
<?php foreach ($log['items'] as $row) :
|
||||
$delta = (int) $row['delta_minor'];
|
||||
<?php foreach ($items as $row) :
|
||||
$delta = (int) ($row['value'] ?? 0);
|
||||
$delta_class = $delta >= 0 ? 'is-positive' : 'is-negative';
|
||||
?>
|
||||
<div class="uc-transactions__item">
|
||||
@@ -35,12 +37,12 @@ defined('ABSPATH') || exit;
|
||||
</div>
|
||||
<div class="uc-transactions__info">
|
||||
<div class="uc-transactions__reason">
|
||||
<?php echo esc_html(aksrt_asset_reason_label((string) $row['reason'])); ?>
|
||||
<?php echo esc_html((string) ($row['desc'] ?? '') !== '' ? (string) $row['desc'] : aksrt_asset_reason_label((string) ($row['type'] ?? ''))); ?>
|
||||
</div>
|
||||
<div class="uc-transactions__time">
|
||||
<?php echo esc_html(get_date_from_gmt((string) $row['created_at'], 'Y-m-d H:i')); ?>
|
||||
<?php echo esc_html((string) ($row['time'] ?? '')); ?>
|
||||
</div>
|
||||
<?php if (!empty($row['counterparty_user_id'])) : ?><div class="muted-2-color em09"><?php printf(esc_html__('对方用户 #%d', 'aksrt'), (int) $row['counterparty_user_id']); ?></div><?php endif; ?>
|
||||
<?php if (!empty($row['order_num'])) : ?><div class="muted-2-color em09"><?php echo esc_html__('订单号:', 'aksrt') . esc_html((string) $row['order_num']); ?></div><?php endif; ?>
|
||||
</div>
|
||||
<div class="uc-transactions__amount">
|
||||
<span class="uc-transactions__delta <?php echo esc_attr($delta_class); ?>">
|
||||
@@ -51,7 +53,7 @@ defined('ABSPATH') || exit;
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php
|
||||
$total_pages = (int) ceil((int) ($log['total'] ?? 0) / 10);
|
||||
$total_pages = (int) ceil(count($history) / 10);
|
||||
if ($total_pages > 1 && function_exists('aksrt_render_asset_pagination')) {
|
||||
aksrt_render_asset_pagination($total_pages, $credits_page, 'points');
|
||||
}
|
||||
@@ -61,7 +63,7 @@ defined('ABSPATH') || exit;
|
||||
<div class="uc-transactions__empty-icon">
|
||||
<i class="fa fas fa-file-alt" aria-hidden="true"></i>
|
||||
</div>
|
||||
<p><?php echo esc_html(sprintf(__('还没有任何%s流水', 'aksrt'), $currency_name)); ?></p>
|
||||
<p><?php echo esc_html(sprintf(__('还没有任何%s记录', 'aksrt'), $currency_name)); ?></p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
Reference in new issue
Block a user