diff --git a/docs/zibll-gap-matrix.md b/docs/zibll-gap-matrix.md
index a0ac5802..e931f61a 100644
--- a/docs/zibll-gap-matrix.md
+++ b/docs/zibll-gap-matrix.md
@@ -99,8 +99,8 @@ Note: zibll「商品管理」`zibpay_product_page` is **paid article sales**, no
| 2b Shipping/after-sale/coupons/income/rebate | done |
| 3 users.php submenus | done |
| 4 SPA strip | done (ops routes redirect to native) |
-| 5+ behavior parity | in progress — shipping list create + pending-to-ship board; after-sale filters/actions; order note/quick actions; coupons field parity + batch/enable; charge-cards expires + code dump + search/labels; product meta shipping/service/limit fields |
-| 5 remaining | forum runtime field parity; express timeline; coupon product_scope UI |
+| 5+ behavior parity | in progress — shipping list create + pending-to-ship board + express timeline query; after-sale filters/actions; order note/quick actions; coupons field parity + batch/enable + product_scope; charge-cards expires + code dump + search/labels; product meta shipping/service/limit fields; plate allow_view/add_limit; topic visibility column |
+| 5 remaining | deeper forum runtime (moderator roles UI, advanced plate options); coupon product_scope batch/edit |
## Dual-UI rule
diff --git a/inc/classes/admin/native/class-aksrt-admin-pay-menus.php b/inc/classes/admin/native/class-aksrt-admin-pay-menus.php
index 88068105..ffd80883 100644
--- a/inc/classes/admin/native/class-aksrt-admin-pay-menus.php
+++ b/inc/classes/admin/native/class-aksrt-admin-pay-menus.php
@@ -36,6 +36,7 @@ class AKSRT_Admin_Pay_Menus {
add_action('admin_post_aksrt_pay_disable_charge_card', [$this, 'handle_disable_charge_card']);
add_action('admin_post_aksrt_pay_batch_charge_cards', [$this, 'handle_batch_charge_cards']);
add_action('admin_post_aksrt_pay_update_shipping', [$this, 'handle_update_shipping']);
+ add_action('admin_post_aksrt_pay_query_express', [$this, 'handle_query_express']);
add_action('admin_post_aksrt_pay_create_shipping', [$this, 'handle_create_shipping']);
add_action('admin_post_aksrt_pay_update_after_sale', [$this, 'handle_update_after_sale']);
add_action('admin_post_aksrt_pay_create_after_sale', [$this, 'handle_create_after_sale']);
@@ -214,6 +215,8 @@ class AKSRT_Admin_Pay_Menus {
'shipping_failed' => __('物流状态更新失败。', 'aksrt'),
'shipping_created' => __('发货记录已创建。', 'aksrt'),
'shipping_create_failed' => __('发货记录创建失败。', 'aksrt'),
+ 'express_ok' => __('物流轨迹已更新。', 'aksrt'),
+ 'express_failed' => __('物流轨迹查询失败。', 'aksrt'),
'after_sale_updated' => __('售后状态已更新。', 'aksrt'),
'after_sale_failed' => __('售后状态更新失败。', 'aksrt'),
'after_sale_created' => __('售后工单已创建。', 'aksrt'),
@@ -1148,6 +1151,7 @@ class AKSRT_Admin_Pay_Menus {
$total = (int) ($result['total'] ?? 0);
$pages = max(1, (int) ceil(max(1, $total) / $per_page));
$row_status_options = $this->shipping_status_options(false);
+ $show_express_id = isset($_GET['express_id']) ? (int) $_GET['express_id'] : 0;
echo '
';
echo '| ID | ' . esc_html__('订单号', 'aksrt') . ' | ' . esc_html__('承运商', 'aksrt') . ' | ' . esc_html__('运单号', 'aksrt') . ' | ' . esc_html__('状态', 'aksrt') . ' | ' . esc_html__('时间', 'aksrt') . ' | ' . esc_html__('操作', 'aksrt') . ' | ';
@@ -1166,7 +1170,8 @@ class AKSRT_Admin_Pay_Menus {
echo '' . esc_html((string) ($row['tracking_no'] ?? '')) . ' | ';
echo '' . esc_html($row_status_options[$st] ?? $st) . ' | ';
echo '' . esc_html((string) ($row['created_at'] ?? '')) . ' | ';
- echo ' |
';
+ echo '';
+ echo '';
+ echo '' . esc_html__('轨迹', 'aksrt') . '';
+ echo '';
+ if ($show_express_id === $id) {
+ echo '| ';
+ $this->render_express_timeline_panel($id);
+ echo ' |
';
+ }
}
echo '
';
$this->render_pagination($pages, $page_num);
@@ -1276,7 +1295,37 @@ class AKSRT_Admin_Pay_Menus {
exit;
}
- wp_safe_redirect($this->page_url('aksrt_shipping', ['aksrt_pay_msg' => $ok ? 'shipping_updated' : 'shipping_failed']));
+ wp_safe_redirect($this->page_url('aksrt_shipping', [
+ 'view' => 'records',
+ 'aksrt_pay_msg' => $ok ? 'shipping_updated' : 'shipping_failed',
+ ]));
+ exit;
+ }
+
+ public function handle_query_express(): void {
+ if (!current_user_can(self::CAPABILITY)) {
+ wp_die(esc_html__('权限不足', 'aksrt'));
+ }
+ $id = isset($_POST['shipping_id']) ? (int) $_POST['shipping_id'] : 0;
+ $force = !empty($_POST['force']);
+ check_admin_referer('aksrt_pay_query_express_' . $id);
+
+ $ok = false;
+ $order_number = '';
+ if ($id > 0 && class_exists('AKSRT_Shipping')) {
+ $svc = AKSRT_Shipping::get_instance();
+ $record = $svc->get($id);
+ $order_number = is_array($record) ? (string) ($record['order_number'] ?? '') : '';
+ $result = $svc->query_express($id, $force);
+ $ok = !empty($result['success']);
+ }
+
+ wp_safe_redirect($this->page_url('aksrt_shipping', [
+ 'view' => 'records',
+ 'express_id' => $id,
+ 's' => $order_number,
+ 'aksrt_pay_msg' => $ok ? 'express_ok' : 'express_failed',
+ ]));
exit;
}
@@ -1594,6 +1643,13 @@ class AKSRT_Admin_Pay_Menus {
echo '';
echo '';
echo '';
+ echo '';
+ echo '';
echo '';
submit_button(__('创建', 'aksrt'), 'primary', '', false);
echo '';
@@ -1653,10 +1709,10 @@ class AKSRT_Admin_Pay_Menus {
$pages = max(1, (int) ($result['total_pages'] ?? 1));
echo '';
- echo '| ID | ' . esc_html__('代码', 'aksrt') . ' | ' . esc_html__('类型', 'aksrt') . ' | ' . esc_html__('面值', 'aksrt') . ' | ' . esc_html__('门槛/封顶', 'aksrt') . ' | ' . esc_html__('已用/上限/每人', 'aksrt') . ' | ' . esc_html__('状态', 'aksrt') . ' | ' . esc_html__('过期', 'aksrt') . ' | ' . esc_html__('操作', 'aksrt') . ' | ';
+ echo 'ID | ' . esc_html__('代码', 'aksrt') . ' | ' . esc_html__('类型', 'aksrt') . ' | ' . esc_html__('面值', 'aksrt') . ' | ' . esc_html__('门槛/封顶', 'aksrt') . ' | ' . esc_html__('范围', 'aksrt') . ' | ' . esc_html__('已用/上限/每人', 'aksrt') . ' | ' . esc_html__('状态', 'aksrt') . ' | ' . esc_html__('过期', 'aksrt') . ' | ' . esc_html__('操作', 'aksrt') . ' | ';
echo '
';
if (!$items) {
- echo '| ' . esc_html__('暂无优惠码', 'aksrt') . ' |
';
+ echo '| ' . esc_html__('暂无优惠码', 'aksrt') . ' |
';
}
foreach ($items as $row) {
$id = (int) ($row['id'] ?? 0);
@@ -1668,6 +1724,7 @@ class AKSRT_Admin_Pay_Menus {
echo '' . esc_html($type_labels[$row_type] ?? $row_type) . ' | ';
echo '' . esc_html((string) ($row['value'] ?? '')) . ($row_type === 'percent' ? '%' : '') . ' | ';
echo '' . esc_html((string) ($row['min_amount'] ?? 0)) . ' / ' . esc_html((string) ($row['max_discount'] ?? 0)) . ' | ';
+ echo '' . esc_html($this->format_coupon_scope_label($row['product_scope'] ?? [])) . ' | ';
echo '' . esc_html((string) ((int) ($row['used_count'] ?? 0)) . '/' . (string) ((int) ($row['usage_limit'] ?? 0)) . '/' . (string) ((int) ($row['per_user_limit'] ?? 0))) . ' | ';
echo '' . esc_html($status_labels[$st] ?? $st) . ' | ';
echo '' . esc_html((string) ($row['expires_at'] ?? '')) . ' | ';
@@ -1719,6 +1776,7 @@ class AKSRT_Admin_Pay_Menus {
'max_discount' => (float) ($_POST['max_discount'] ?? 0),
'usage_limit' => (int) ($_POST['usage_limit'] ?? 0),
'per_user_limit' => (int) ($_POST['per_user_limit'] ?? 0),
+ 'product_scope' => $this->parse_coupon_product_scope_from_request(),
'expires_at' => $expires,
]);
$ok = $id > 0;
@@ -2128,6 +2186,82 @@ class AKSRT_Admin_Pay_Menus {
}
}
+ private function render_express_timeline_panel(int $shipping_id): void {
+ if ($shipping_id <= 0 || !class_exists('AKSRT_Shipping')) {
+ echo '' . esc_html__('无法加载物流轨迹。', 'aksrt') . '
';
+ return;
+ }
+ $svc = AKSRT_Shipping::get_instance();
+ // Prefer cached data; do not force remote query on pure view.
+ $timeline = $svc->build_express_timeline($shipping_id);
+ $record = $svc->get($shipping_id);
+ echo '';
+ echo '
' . esc_html__('物流轨迹', 'aksrt') . ' · ';
+ echo esc_html((string) ($record['carrier'] ?? '')) . ' / ' . esc_html((string) ($record['tracking_no'] ?? ''));
+ echo '
';
+ if (!$timeline) {
+ echo '
' . esc_html__('暂无轨迹,可点击「查物流」拉取快递 API。', 'aksrt') . '
';
+ echo '
';
+ return;
+ }
+ echo '';
+ // newest first for operators
+ $timeline = array_reverse($timeline);
+ foreach ($timeline as $item) {
+ $time = (string) ($item['time'] ?? '');
+ $label = (string) ($item['label'] ?? '');
+ echo '' . esc_html($time) . ' ' . esc_html($label) . ' ';
+ }
+ echo '
';
+ }
+
+ /**
+ * @return array
+ */
+ private function parse_coupon_product_scope_from_request(): array {
+ $type = isset($_POST['scope_type']) ? sanitize_key((string) wp_unslash($_POST['scope_type'])) : '';
+ if ($type === '' || !in_array($type, ['include', 'exclude', 'category'], true)) {
+ return [];
+ }
+ $raw = isset($_POST['scope_ids']) ? (string) wp_unslash($_POST['scope_ids']) : '';
+ $parts = preg_split('/[\s,;]+/', $raw) ?: [];
+ $ids = array_values(array_unique(array_filter(array_map('intval', $parts))));
+ if (!$ids) {
+ return [];
+ }
+ $scope = [
+ 'type' => $type,
+ 'ids' => $ids,
+ ];
+ if ($type === 'category') {
+ $scope['taxonomies'] = ['aksrt_product_cat', 'category'];
+ }
+ return $scope;
+ }
+
+ /**
+ * @param mixed $scope
+ */
+ private function format_coupon_scope_label($scope): string {
+ if (is_string($scope) && $scope !== '') {
+ $decoded = json_decode($scope, true);
+ $scope = is_array($decoded) ? $decoded : [];
+ }
+ if (!is_array($scope) || empty($scope)) {
+ return __('全部', 'aksrt');
+ }
+ $type = sanitize_key((string) ($scope['type'] ?? ''));
+ $ids = array_map('intval', (array) ($scope['ids'] ?? []));
+ $id_text = $ids ? implode(',', $ids) : '—';
+ $map = [
+ 'include' => __('含商品', 'aksrt'),
+ 'exclude' => __('排除商品', 'aksrt'),
+ 'category' => __('分类', 'aksrt'),
+ ];
+ $label = $map[$type] ?? $type;
+ return $label . ':' . $id_text;
+ }
+
private function render_pagination(int $pages, int $page_num): void {
if ($pages <= 1) {
return;
diff --git a/inc/classes/forum/class-aksrt-plate-meta-box.php b/inc/classes/forum/class-aksrt-plate-meta-box.php
index dbd2ff95..03888059 100644
--- a/inc/classes/forum/class-aksrt-plate-meta-box.php
+++ b/inc/classes/forum/class-aksrt-plate-meta-box.php
@@ -52,6 +52,8 @@ class AKSRT_Plate_Meta_Box {
$applications = get_post_meta($post->ID, '_aksrt_moderator_applications', true);
$applications = is_array($applications) ? $applications : [];
}
+ $allow_view = (string) (get_post_meta($post->ID, '_aksrt_allow_view', true) ?: 'public');
+ $add_limit = (string) (get_post_meta($post->ID, '_aksrt_add_limit', true) ?: 'all');
$moderator_labels = [];
foreach ($moderator_ids as $uid) {
@@ -61,6 +63,30 @@ class AKSRT_Plate_Meta_Box {
: (string) (int) $uid;
}
?>
+
+
+
+
+
+
+
+
@@ -111,6 +137,18 @@ class AKSRT_Plate_Meta_Box {
return;
}
+ $allow_view = isset($_POST['aksrt_plate_allow_view']) ? sanitize_key((string) wp_unslash($_POST['aksrt_plate_allow_view'])) : 'public';
+ if (!in_array($allow_view, ['public', 'login', 'moderator'], true)) {
+ $allow_view = 'public';
+ }
+ update_post_meta($post_id, '_aksrt_allow_view', $allow_view);
+
+ $add_limit = isset($_POST['aksrt_plate_add_limit']) ? sanitize_key((string) wp_unslash($_POST['aksrt_plate_add_limit'])) : 'all';
+ if (!in_array($add_limit, ['all', 'login', 'moderator'], true)) {
+ $add_limit = 'all';
+ }
+ update_post_meta($post_id, '_aksrt_add_limit', $add_limit);
+
$raw = isset($_POST['aksrt_plate_moderators']) ? (string) wp_unslash($_POST['aksrt_plate_moderators']) : '';
$ids = preg_split('/[\s,;]+/', $raw) ?: [];
$ids = array_values(array_unique(array_filter(array_map('intval', $ids))));
diff --git a/inc/classes/forum/class-aksrt-topic-admin-list.php b/inc/classes/forum/class-aksrt-topic-admin-list.php
index f0d584f1..0ac0416b 100644
--- a/inc/classes/forum/class-aksrt-topic-admin-list.php
+++ b/inc/classes/forum/class-aksrt-topic-admin-list.php
@@ -46,6 +46,7 @@ class AKSRT_Topic_Admin_List {
$new['aksrt_locked'] = __('锁定', 'aksrt');
$new['aksrt_review'] = __('审核', 'aksrt');
$new['aksrt_bbs_type']= __('类型', 'aksrt');
+ $new['aksrt_visibility'] = __('可见性', 'aksrt');
$new['aksrt_views'] = __('阅读', 'aksrt');
}
}
@@ -116,6 +117,20 @@ class AKSRT_Topic_Admin_List {
echo esc_html($type === 'question' ? __('提问', 'aksrt') : __('标准', 'aksrt'));
break;
+ case 'aksrt_visibility':
+ $visibility = (string) (get_post_meta($post_id, '_aksrt_visibility', true) ?: 'public');
+ $map = [
+ 'public' => __('公开', 'aksrt'),
+ 'login' => __('登录', 'aksrt'),
+ 'comment' => __('评论', 'aksrt'),
+ 'role' => __('角色', 'aksrt'),
+ 'credits' => __('积分', 'aksrt'),
+ 'pay' => __('付费', 'aksrt'),
+ 'moderator' => __('版主', 'aksrt'),
+ ];
+ echo esc_html($map[$visibility] ?? $visibility);
+ break;
+
case 'aksrt_views':
echo esc_html((string) (int) get_post_meta($post_id, '_aksrt_views', true));
break;