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
+6
-38
@@ -266,51 +266,19 @@ class Shop {
|
||||
}
|
||||
|
||||
public function get_order_center_view(int $user_id, array $args = []): array {
|
||||
if ($user_id <= 0 || !class_exists('\AKSRT\Payment\OrderRepository')) {
|
||||
return ['items' => [], 'total' => 0, 'total_pages' => 1, 'page' => 1];
|
||||
if (class_exists('\AKSRT\Payment\UserOrders')) {
|
||||
return \AKSRT\Payment\UserOrders::get_instance()->get_order_center_view($user_id, $args);
|
||||
}
|
||||
|
||||
$page = max(1, (int) ($args['page'] ?? 1));
|
||||
$per_page = max(1, min(50, (int) ($args['per_page'] ?? 20)));
|
||||
$status = sanitize_key((string) ($args['status'] ?? ''));
|
||||
|
||||
$repo_args = [
|
||||
'limit' => $per_page,
|
||||
'offset' => ($page - 1) * $per_page,
|
||||
];
|
||||
|
||||
if ($status !== '') {
|
||||
$repo_args['status'] = $status;
|
||||
}
|
||||
|
||||
$repo = \AKSRT\Payment\OrderRepository::get_instance();
|
||||
$orders = $repo->get_user_orders($user_id, $repo_args);
|
||||
$total = $repo->count_user_orders($user_id, $repo_args);
|
||||
|
||||
$items = [];
|
||||
foreach ($orders as $order) {
|
||||
$items[] = $this->decorate_order_view($order);
|
||||
}
|
||||
|
||||
return [
|
||||
'items' => $items,
|
||||
'total' => $total,
|
||||
'total_pages' => max(1, (int) ceil($total / $per_page)),
|
||||
'page' => $page,
|
||||
];
|
||||
return ['items' => [], 'total' => 0, 'total_pages' => 1, 'page' => 1, 'stats' => [], 'product_types' => []];
|
||||
}
|
||||
|
||||
public function get_order_detail_view(int $user_id, string $order_number): ?array {
|
||||
if ($user_id <= 0 || $order_number === '' || !class_exists('\AKSRT\Payment\OrderRepository')) {
|
||||
return null;
|
||||
if (class_exists('\AKSRT\Payment\UserOrders')) {
|
||||
return \AKSRT\Payment\UserOrders::get_instance()->get_order_detail_view($user_id, $order_number);
|
||||
}
|
||||
|
||||
$order = \AKSRT\Payment\OrderRepository::get_instance()->get_user_order($user_id, $order_number);
|
||||
if (!$order) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->decorate_order_view($order, true);
|
||||
return null;
|
||||
}
|
||||
|
||||
public function preview_checkout(int $user_id, array $payload): array {
|
||||
|
||||
Reference in new issue
Block a user