feat(orders): full-chain My Orders for all product types
Unify front-end order center across shop, content, VIP, recharge, points, and plate-follow with type filters, stats, and type-aware cards; keep shop-only fulfillment actions; ensure 权益与消费 entry URL.
This commit is contained in:
1 parent
85ade059a2
commit
3baa8573c9
8 files changed
+841
-152
No files matched your search
@@ -52,21 +52,38 @@ function aksrt_get_cart_page_view(int $user_id): array {
|
||||
return \AKSRT\Shop\Shop::get_instance()->get_cart_page_view($user_id);
|
||||
}
|
||||
|
||||
function aksrt_get_orders_page_view(int $user_id, int $paged = 1, int $per_page = 20, string $status = ''): array {
|
||||
if ($user_id <= 0 || !class_exists('\AKSRT\Shop\Shop')) {
|
||||
return [
|
||||
'items' => [],
|
||||
'total' => 0,
|
||||
'total_pages' => 1,
|
||||
'page' => 1,
|
||||
];
|
||||
function aksrt_get_orders_page_view(int $user_id, int $paged = 1, int $per_page = 20, string $status = '', string $product_type = ''): array {
|
||||
$empty = [
|
||||
'items' => [],
|
||||
'total' => 0,
|
||||
'total_pages' => 1,
|
||||
'page' => 1,
|
||||
'stats' => ['total' => 0, 'pending' => 0, 'paid' => 0],
|
||||
'product_types' => class_exists('\AKSRT\Core\DomainModel')
|
||||
? array_merge(['' => __('全部类型', 'aksrt')], \AKSRT\Core\DomainModel::order_product_type_labels())
|
||||
: [],
|
||||
];
|
||||
|
||||
if ($user_id <= 0) {
|
||||
return $empty;
|
||||
}
|
||||
|
||||
return \AKSRT\Shop\Shop::get_instance()->get_order_center_view($user_id, [
|
||||
'page' => $paged,
|
||||
'per_page' => $per_page,
|
||||
'status' => $status,
|
||||
]);
|
||||
$args = [
|
||||
'page' => $paged,
|
||||
'per_page' => $per_page,
|
||||
'status' => $status,
|
||||
'product_type' => $product_type,
|
||||
];
|
||||
|
||||
if (class_exists('\AKSRT\Payment\UserOrders')) {
|
||||
return \AKSRT\Payment\UserOrders::get_instance()->get_order_center_view($user_id, $args);
|
||||
}
|
||||
|
||||
if (class_exists('\AKSRT\Shop\Shop')) {
|
||||
return \AKSRT\Shop\Shop::get_instance()->get_order_center_view($user_id, $args);
|
||||
}
|
||||
|
||||
return $empty;
|
||||
}
|
||||
|
||||
function aksrt_get_revenue_page_view(int $user_id): array {
|
||||
|
||||
@@ -74,12 +74,16 @@ endif;
|
||||
if (!function_exists('aksrt_get_orders_page_url')) :
|
||||
/**
|
||||
* 订单中心页面 URL(模板 templates/pages/page-orders.php)。
|
||||
* 未指派页面时返回空串,调用方应隐藏入口。
|
||||
* 未指派页面时回退 /orders/(与 Scripts 路由一致),保证「权益与消费」入口可用。
|
||||
*/
|
||||
function aksrt_get_orders_page_url(): string {
|
||||
return function_exists('aksrt_get_page_url_by_template')
|
||||
$url = function_exists('aksrt_get_page_url_by_template')
|
||||
? aksrt_get_page_url_by_template('templates/pages/page-orders.php')
|
||||
: '';
|
||||
if ($url !== '') {
|
||||
return $url;
|
||||
}
|
||||
return home_url('/orders/');
|
||||
}
|
||||
endif;
|
||||
|
||||
|
||||
Reference in new issue
Block a user