From 4cb9cd2f6620e6260ff61a396345350d5471e0e3 Mon Sep 17 00:00:00 2001 From: qiuxiang <394405259@qq.com> Date: Fri, 18 Sep 2026 16:48:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=B4=A6=E6=88=B7=E8=B4=A6?= =?UTF-8?q?=E5=8D=95=E7=AD=9B=E9=80=89=E4=B8=8E=E5=AF=BC=E5=87=BA=E8=8C=83?= =?UTF-8?q?=E5=9B=B4=E4=B8=80=E8=87=B4=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Http/Controllers/AccountBills.php | 1 + .../DouyinAuthoritativeBillRepository.php | 9 ++ ...oreReceivingAlipayBillMirrorRepository.php | 9 ++ .../js/components/business/AccountBills.vue | 52 +++++++--- .../DouyinAuthoritativeBillTest.php | 23 +++++ .../account-bills-filter-export.test.cjs | 97 +++++++++++++++++++ 6 files changed, 175 insertions(+), 16 deletions(-) create mode 100644 tests/scripts/account-bills-filter-export.test.cjs diff --git a/modules/EcommerceFinance/Http/Controllers/AccountBills.php b/modules/EcommerceFinance/Http/Controllers/AccountBills.php index 7b550a21..d4ce3a67 100644 --- a/modules/EcommerceFinance/Http/Controllers/AccountBills.php +++ b/modules/EcommerceFinance/Http/Controllers/AccountBills.php @@ -358,6 +358,7 @@ class AccountBills extends Controller 'start' => ['nullable', 'date_format:Y-m-d'], 'end' => ['nullable', 'date_format:Y-m-d', 'after_or_equal:start'], 'keyword' => ['nullable', 'string', 'max:255'], + 'keyword_match' => ['nullable', 'in:contains,exact-record'], ]); return array_map(static fn (mixed $value): string => trim((string) $value), $filters); diff --git a/modules/EcommerceFinance/Repositories/DouyinAuthoritativeBillRepository.php b/modules/EcommerceFinance/Repositories/DouyinAuthoritativeBillRepository.php index b75b6a85..fda0ef3d 100644 --- a/modules/EcommerceFinance/Repositories/DouyinAuthoritativeBillRepository.php +++ b/modules/EcommerceFinance/Repositories/DouyinAuthoritativeBillRepository.php @@ -124,6 +124,15 @@ class DouyinAuthoritativeBillRepository if (($filters['start'] ?? '') !== '') $query->where($date, '>=', $filters['start'] . ' 00:00:00'); if (($filters['end'] ?? '') !== '') $query->where($date, '<', date('Y-m-d', strtotime($filters['end'] . ' +1 day')) . ' 00:00:00'); if (($filters['keyword'] ?? '') !== '') { + if (($filters['keyword_match'] ?? '') === 'exact-record') { + $keyword = (string) $filters['keyword']; + if ($legacy && (! preg_match('/^(0|[1-9]\d{0,9})$/', $keyword) || (float) $keyword > 2147483647)) { + $query->whereRaw('1 = 0'); + } else { + $query->where($legacy ? 'b.Id' : 'record_code', $keyword); + } + return; + } $value = '%' . $this->escape($filters['keyword']) . '%'; $columns = $legacy ? ['b.Id', 'b.auto_id', 'b.fee_name', 'b.primary_key', 'b.p_auto_id', 'b.so_id', 'b.sku_id', 'b.shop_sku_id', 'b.shop_i_id', 'b.channel'] : ['record_code', 'order_no', 'bill_item', 'row_data']; diff --git a/modules/EcommerceFinance/Repositories/StoreReceivingAlipayBillMirrorRepository.php b/modules/EcommerceFinance/Repositories/StoreReceivingAlipayBillMirrorRepository.php index 8e0c68f3..6b68c570 100644 --- a/modules/EcommerceFinance/Repositories/StoreReceivingAlipayBillMirrorRepository.php +++ b/modules/EcommerceFinance/Repositories/StoreReceivingAlipayBillMirrorRepository.php @@ -393,6 +393,15 @@ class StoreReceivingAlipayBillMirrorRepository $query->where('b.fee_time', '<', date('Y-m-d', strtotime($filters['end'] . ' +1 day')) . ' 00:00:00'); } if (($filters['keyword'] ?? '') !== '') { + if (($filters['keyword_match'] ?? '') === 'exact-record') { + $keyword = (string) $filters['keyword']; + if (! preg_match('/^(0|[1-9]\d{0,9})$/', $keyword) || (float) $keyword > 2147483647) { + $query->whereRaw('1 = 0'); + } else { + $query->where('b.Id', $keyword); + } + return; + } $value = '%' . $this->escapeLike((string) $filters['keyword']) . '%'; $query->where(function (Builder $query) use ($value): void { foreach (['b.Id', 'b.auto_id', 'b.fee_name', 'b.primary_key', 'b.p_auto_id', 'b.so_id', 'b.sku_id', 'b.shop_sku_id', 'b.shop_i_id', 'b.channel'] as $column) { diff --git a/resources/assets/js/components/business/AccountBills.vue b/resources/assets/js/components/business/AccountBills.vue index b0a3f5e5..f4ac17da 100644 --- a/resources/assets/js/components/business/AccountBills.vue +++ b/resources/assets/js/components/business/AccountBills.vue @@ -5,23 +5,23 @@