feat(admin): deeper order/income filters, post pay-type, topic sales meta

Add order user/payment filters, income/rebate user_id filter, posts list
pay_type dropdown, topic virtual_sales/coupon meta, and forum unlock
facade methods used by hidecontent/payshow.
This commit is contained in:
kate522 committed 2026-07-15 11:35:35 +08:00
1 parent 8d31e65ccd
commit f197745830
11 files changed
+222 -30

No files matched your search

@@ -96,6 +96,8 @@ class AKSRT_Topic_Meta_Box {
$credits_vip2 = get_post_meta($post->ID, '_aksrt_credits_vip2', true);
$credits_vip1_set = ($credits_vip1 !== '' && $credits_vip1 !== null && $credits_vip1 !== false);
$credits_vip2_set = ($credits_vip2 !== '' && $credits_vip2 !== null && $credits_vip2 !== false);
$virtual_sales = max(0, (int) get_post_meta($post->ID, '_aksrt_virtual_sales', true));
$coupon_s = (int) get_post_meta($post->ID, '_aksrt_topic_coupon_s', true) === 1;
$pay_hide_part = (int) get_post_meta($post->ID, '_aksrt_pay_hide_part', true) === 1;
$view_roles = get_post_meta($post->ID, '_aksrt_visibility_roles', true);
if (!is_array($view_roles)) {
@@ -213,6 +215,18 @@ class AKSRT_Topic_Meta_Box {
</label>
<span class="description" style="display:block;"><?php esc_html_e('开启后正文仍输出,付费块用 [payshow] 或 [hidecontent type="payshow"] 包裹。未开启则全文门控。', 'aksrt'); ?></span>
</p>
<p class="aksrt-topic-meta-pay-fields aksrt-topic-meta-credits-fields">
<label for="aksrt_virtual_sales"><strong><?php esc_html_e('虚拟销量', 'aksrt'); ?></strong></label>
<input type="number" step="1" min="0" class="widefat" name="aksrt_virtual_sales" id="aksrt_virtual_sales" value="<?php echo esc_attr((string) $virtual_sales); ?>">
<span class="description"><?php esc_html_e('展示用浮动销量,不计入真实订单统计。', 'aksrt'); ?></span>
</p>
<p class="aksrt-topic-meta-pay-fields">
<label>
<input type="checkbox" name="aksrt_topic_coupon_s" value="1" <?php checked($coupon_s); ?>>
<?php esc_html_e('允许优惠码(预留)', 'aksrt'); ?>
</label>
<span class="description" style="display:block;"><?php esc_html_e('标记本帖允许优惠码;收银台多网关接入前仅存 meta。', 'aksrt'); ?></span>
</p>
<?php
}
@@ -362,8 +376,21 @@ class AKSRT_Topic_Meta_Box {
// Partial hide only meaningful for pay/credits; otherwise clear.
if (in_array($visibility, ['pay', 'credits'], true)) {
update_post_meta($post_id, '_aksrt_pay_hide_part', !empty($_POST['aksrt_pay_hide_part']) ? 1 : 0);
$virtual = isset($_POST['aksrt_virtual_sales']) ? max(0, (int) wp_unslash($_POST['aksrt_virtual_sales'])) : 0;
if ($virtual > 0) {
update_post_meta($post_id, '_aksrt_virtual_sales', $virtual);
} else {
delete_post_meta($post_id, '_aksrt_virtual_sales');
}
if ($visibility === 'pay') {
update_post_meta($post_id, '_aksrt_topic_coupon_s', !empty($_POST['aksrt_topic_coupon_s']) ? 1 : 0);
} else {
delete_post_meta($post_id, '_aksrt_topic_coupon_s');
}
} else {
delete_post_meta($post_id, '_aksrt_pay_hide_part');
delete_post_meta($post_id, '_aksrt_virtual_sales');
delete_post_meta($post_id, '_aksrt_topic_coupon_s');
}
}