Full-project rename. `git grep -i aksrt` is now empty apart from the
DBMigrator 3.3.0 changelog note that documents the rename itself.
Code identifiers
- PHP namespace AKSRT\ -> Jio\ (composer PSR-4 + 378 declarations)
- global constants AKSRT_* -> JIO_* (VERSION/DIR/URI, PAY_TYPE_*, CAPTCHA_*)
- procedural functions, hooks, options, meta keys, table names,
cookies, query vars, ajax actions and nonces: aksrt_ -> jio_
- text domain aksrt -> jio; Theme Name -> Jio
- JS globals: aksrtData/aksrtAdminData/... -> jioData/jioAdminData/...,
window.AKSRTCaptcha & friends -> window.JioCaptcha, Aksrt* -> Jio*
- Vue components Aks*.vue -> Jio*.vue (15 files renamed + imports)
- CSS classes/data-attrs/custom properties: aksrt- -> jio-
- REST namespace aksrt/v1 -> jio/v1 (incl. payment gateway callbacks)
Storage layer
- DB tables {prefix}aksrt_* -> {prefix}jio_*; SCHEMA_VERSION 3.2.0 -> 3.3.0
so dbDelta creates the new names on install
- widget id_base aksrt_widget_* -> jio_widget_*
- uninstall.php drop list rebuilt from the actual migrator tables
(dropped 3 stale entries, added the 17 missing ones)
Removed
- hardcoded https://api.aksrt.com/version.json default update endpoint;
get_endpoint() now reads the 「更新端点」 setting and do_check() no-ops
when it is empty
Files renamed: inc/helpers/aksrt-*.php -> jio-*.php (54),
assets/admin/src/components/form/Aks*.vue -> Jio*.vue (15).
Build artifacts regenerated: assets/css/build, assets/js/runtime,
assets/admin/build.
Verified: audit-psr4-paths errors=0, audit-admin-contracts errors=0
(warnings=56, unchanged baseline), 813/813 widget-system tests,
44/44 phpunit, php -l clean across all PHP.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
134 lines
9.8 KiB
PHP
134 lines
9.8 KiB
PHP
<?php
|
|
/**
|
|
* User-center knowledge-payment order panel.
|
|
*
|
|
* @package Jio
|
|
*/
|
|
|
|
defined('ABSPATH') || exit;
|
|
|
|
$context = is_array($args['context'] ?? null) ? $args['context'] : [];
|
|
$user_id = (int) ($context['user_id'] ?? get_current_user_id());
|
|
if ($user_id <= 0) {
|
|
echo '<div class="uc-panel-empty muted-2-color">' . esc_html__('请先登录', 'jio') . '</div>';
|
|
return;
|
|
}
|
|
|
|
$raw_query = [
|
|
'status' => 'all',
|
|
'type' => '',
|
|
'order_number' => '',
|
|
'page' => 1,
|
|
'per_page' => 20,
|
|
];
|
|
$query = \Jio\Payment\OrderCenterQuery::from_array($raw_query);
|
|
$orders_view = function_exists('jio_get_orders_page_view')
|
|
? jio_get_orders_page_view($user_id, $query->page(), $query->per_page(), $query->status(), $query->product_type(), $query->order_number())
|
|
: ['items' => [], 'total' => 0, 'total_pages' => 1, 'page' => 1, 'stats' => [], 'product_types' => []];
|
|
|
|
$orders = (array) ($orders_view['items'] ?? []);
|
|
$stats = is_array($orders_view['stats'] ?? null) ? $orders_view['stats'] : [];
|
|
$type_options = is_array($orders_view['product_types'] ?? null) ? $orders_view['product_types'] : [];
|
|
$page = max(1, (int) ($orders_view['page'] ?? 1));
|
|
$total_pages = max(1, (int) ($orders_view['total_pages'] ?? 1));
|
|
$status = $query->status();
|
|
$type = $query->product_type();
|
|
$order_number = $query->order_number();
|
|
|
|
$status_options = [
|
|
'all' => __('全部', 'jio'),
|
|
'pending' => __('待支付', 'jio'),
|
|
'paid' => __('已支付', 'jio'),
|
|
'refunded' => __('已退款', 'jio'),
|
|
'closed' => __('已关闭', 'jio'),
|
|
];
|
|
?>
|
|
<div class="jio-orders-page uc-orders-panel" data-jio-order-center>
|
|
<header class="uc-orders-panel__head">
|
|
<div class="uc-orders-panel__title-wrap">
|
|
<p class="jio-orders-page__eyebrow"><?php esc_html_e('我的购买', 'jio'); ?></p>
|
|
<div class="uc-orders-panel__title font-bold em12">
|
|
<i class="fa fas fa-file-alt uc-orders-panel__title-icon" aria-hidden="true"></i>
|
|
<?php esc_html_e('我的订单', 'jio'); ?>
|
|
</div>
|
|
<p class="muted-2-color em09 mt3"><?php esc_html_e('管理已购内容、会员与账户权益。', 'jio'); ?></p>
|
|
</div>
|
|
<div class="jio-orders-page__stats" data-jio-order-stats>
|
|
<div class="jio-orders-page__stat"><span><?php esc_html_e('全部', 'jio'); ?></span><strong><?php echo esc_html((string) (int) ($stats['total'] ?? 0)); ?></strong></div>
|
|
<div class="jio-orders-page__stat"><span><?php esc_html_e('待支付', 'jio'); ?></span><strong class="is-pending"><?php echo esc_html((string) (int) ($stats['pending'] ?? 0)); ?></strong></div>
|
|
<div class="jio-orders-page__stat"><span><?php esc_html_e('已支付', 'jio'); ?></span><strong class="is-paid"><?php echo esc_html((string) (int) ($stats['paid'] ?? 0)); ?></strong></div>
|
|
<div class="jio-orders-page__stat"><span><?php esc_html_e('已关闭', 'jio'); ?></span><strong><?php echo esc_html((string) (int) ($stats['closed'] ?? 0)); ?></strong></div>
|
|
</div>
|
|
</header>
|
|
|
|
<form class="jio-orders-page__search" data-jio-orders-search>
|
|
<label class="screen-reader-text" for="jio-order-number"><?php esc_html_e('按订单号查找', 'jio'); ?></label>
|
|
<i class="fa fas fa-search" aria-hidden="true"></i>
|
|
<input id="jio-order-number" value="<?php echo esc_attr($order_number); ?>" maxlength="22" placeholder="<?php esc_attr_e('输入订单号查找', 'jio'); ?>">
|
|
<button class="btn-primary" type="submit"><?php esc_html_e('查找', 'jio'); ?></button>
|
|
<button class="jio-orders-page__filter-toggle" type="button" data-jio-orders-filter-toggle aria-expanded="false" aria-controls="jio-orders-filter-panel"><i class="fa fas fa-sliders-h" aria-hidden="true"></i> <?php esc_html_e('筛选', 'jio'); ?></button>
|
|
</form>
|
|
|
|
<div id="jio-orders-filter-panel" class="jio-orders-page__filter-panel" data-jio-orders-filter-panel hidden>
|
|
<div class="jio-orders-page__filter-group">
|
|
<span class="jio-orders-page__filter-label"><?php esc_html_e('订单状态', 'jio'); ?></span>
|
|
<nav class="jio-orders-page__status-filters" aria-label="<?php esc_attr_e('订单状态', 'jio'); ?>">
|
|
<?php foreach ($status_options as $key => $label) : ?>
|
|
<button class="jio-orders-page__filter-chip<?php echo $status === $key ? ' is-active' : ''; ?>" type="button" data-jio-order-filter="status" data-jio-order-filter-value="<?php echo esc_attr($key); ?>" aria-pressed="<?php echo $status === $key ? 'true' : 'false'; ?>">
|
|
<?php echo esc_html($label); ?>
|
|
<?php if ($key === 'pending') : ?><span class="jio-orders-page__filter-count"<?php echo empty($stats['pending']) ? ' hidden' : ''; ?>><?php echo esc_html((string) (int) ($stats['pending'] ?? 0)); ?></span><?php endif; ?>
|
|
</button>
|
|
<?php endforeach; ?>
|
|
</nav>
|
|
</div>
|
|
<div class="jio-orders-page__filter-group">
|
|
<span class="jio-orders-page__filter-label"><?php esc_html_e('订单类型', 'jio'); ?></span>
|
|
<div class="jio-orders-page__type-filters">
|
|
<?php foreach ($type_options as $key => $label) : ?>
|
|
<button class="jio-orders-page__filter-chip<?php echo (string) $key === $type ? ' is-active' : ''; ?>" type="button" data-jio-order-filter="type" data-jio-order-filter-value="<?php echo esc_attr((string) $key); ?>" aria-pressed="<?php echo (string) $key === $type ? 'true' : 'false'; ?>"><?php echo esc_html((string) $label); ?></button>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
</div>
|
|
<button class="jio-orders-page__clear" type="button" data-jio-orders-clear><?php esc_html_e('清除条件', 'jio'); ?></button>
|
|
</div>
|
|
|
|
<?php if ($orders !== []) : ?>
|
|
<div class="jio-orders-page__list" data-jio-order-list>
|
|
<?php foreach ($orders as $order) :
|
|
$number = (string) ($order['order_number'] ?? '');
|
|
$actions = (array) ($order['allowed_actions'] ?? []);
|
|
if (!empty($order['is_points'])) {
|
|
$amount = esc_html((string) ($order['currency_symbol'] ?? __('积分', 'jio')) . ' ' . (string) max(0, (int) ($order['amount'] ?? 0)));
|
|
} else {
|
|
try {
|
|
$order_amount = \Jio\Ledger\AssetAmount::balance(is_string($order['amount'] ?? null) ? $order['amount'] : '')->formatted();
|
|
} catch (\InvalidArgumentException $e) {
|
|
$order_amount = '0.00';
|
|
}
|
|
$amount = '¥' . esc_html($order_amount);
|
|
}
|
|
?>
|
|
<article class="jio-orders-page__card" data-jio-order-card="<?php echo esc_attr($number); ?>" data-order-status="<?php echo esc_attr((string) ($order['status_group'] ?? '')); ?>">
|
|
<div class="jio-orders-page__card-rail"><span><?php echo esc_html((string) ($order['product_type_label'] ?? '')); ?></span><time><?php echo esc_html((string) ($order['created_at'] ?? '')); ?></time><span class="jio-orders-page__card-status is-<?php echo esc_attr((string) ($order['status_group'] ?? '')); ?>"><?php echo esc_html((string) ($order['status_label'] ?? '')); ?></span></div>
|
|
<div class="jio-orders-page__card-main">
|
|
<?php if (!empty($order['image'])) : ?><img class="jio-orders-page__card-img" src="<?php echo esc_url((string) $order['image']); ?>" alt=""><?php else : ?><div class="jio-orders-page__card-art" aria-hidden="true"><i class="fa fas fa-book"></i></div><?php endif; ?>
|
|
<div class="jio-orders-page__card-copy"><h3><?php echo esc_html((string) ($order['product_name'] ?? __('订单', 'jio'))); ?></h3><p><?php printf(esc_html__('订单号 %s', 'jio'), esc_html($number)); ?></p></div>
|
|
<div class="jio-orders-page__card-value"><strong><?php echo $amount; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></strong><span><?php esc_html_e('实付', 'jio'); ?></span></div>
|
|
</div>
|
|
<footer class="jio-orders-page__card-actions">
|
|
<?php if (!empty($order['time_left'])) : ?><span class="jio-orders-page__countdown" data-jio-order-countdown="<?php echo esc_attr((string) $order['time_left']); ?>"></span><?php endif; ?>
|
|
<button class="btn-outline" type="button" data-jio-order-detail="<?php echo esc_attr($number); ?>"><?php esc_html_e('订单详情', 'jio'); ?></button>
|
|
<?php if (!empty($actions['can_cancel'])) : ?><button class="btn-ghost" type="button" data-jio-order-cancel="<?php echo esc_attr($number); ?>"><?php esc_html_e('关闭订单', 'jio'); ?></button><?php endif; ?>
|
|
<?php if (!empty($actions['can_pay'])) : ?><button class="btn-primary" type="button" data-jio-order-pay="<?php echo esc_attr($number); ?>" data-jio-order-method="<?php echo esc_attr((string) ($order['payment_method']['value'] ?? '')); ?>"><?php esc_html_e('继续支付', 'jio'); ?></button><?php endif; ?>
|
|
</footer>
|
|
</article>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
<?php if ($total_pages > 1) : ?><nav class="jio-orders-page__pagination" aria-label="<?php esc_attr_e('订单分页', 'jio'); ?>"><?php for ($index = 1; $index <= $total_pages; $index++) : ?><button class="jio-orders-page__page-chip<?php echo $index === $page ? ' is-active' : ''; ?>" type="button" data-jio-order-page="<?php echo esc_attr((string) $index); ?>"<?php echo $index === $page ? ' aria-current="page"' : ''; ?>><?php echo esc_html((string) $index); ?></button><?php endfor; ?></nav><?php endif; ?>
|
|
<?php else : ?>
|
|
<div class="jio-orders-page__empty" data-jio-order-list><i class="fa fas fa-file-alt" aria-hidden="true"></i><h3><?php esc_html_e('还没有购买记录', 'jio'); ?></h3><p><?php esc_html_e('购买内容或开通权益后,订单会出现在这里。', 'jio'); ?></p></div>
|
|
<?php endif; ?>
|
|
|
|
|
|
</div>
|