feat(admin): coupon field parity/batch and charge-card UX polish

Native coupons expose per-user limit, max discount, batch generate, enable;
charge cards support expires_at, code dump after batch, search and CN labels.
This commit is contained in:
2026-07-15 02:54:54 +08:00
parent 7a1069f003
commit d1697c19d9
4 changed files with 221 additions and 22 deletions
+12
View File
@@ -612,6 +612,7 @@ class AKSRT_Charge_Card {
$offset = max(0, (int) ($args['offset'] ?? 0));
$status = sanitize_key((string) ($args['status'] ?? ''));
$type = sanitize_key((string) ($args['type'] ?? ''));
$search = sanitize_text_field((string) ($args['search'] ?? $args['s'] ?? ''));
$where = [];
$params = [];
@@ -620,9 +621,20 @@ class AKSRT_Charge_Card {
$params[] = $status;
}
if ($type !== '') {
if ($type === 'points') {
$type = self::TYPE_CREDITS;
}
$where[] = 'type = %s';
$params[] = $type;
}
if ($search !== '') {
$like = '%' . $wpdb->esc_like($search) . '%';
$where[] = '(password LIKE %s OR card LIKE %s OR note LIKE %s OR CAST(id AS CHAR) = %s)';
$params[] = $like;
$params[] = $like;
$params[] = $like;
$params[] = $search;
}
$where_sql = $where ? 'WHERE ' . implode(' AND ', $where) : '';
$count_sql = "SELECT COUNT(*) FROM {$this->table()} {$where_sql}";