From 3c4f47b3fc5f2bf4f18c5e0bcff970a2448f4420 Mon Sep 17 00:00:00 2001 From: qiuxiang <394405259@qq.com> Date: Wed, 7 Oct 2026 15:30:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=80=BB=E8=B4=A6=E5=A4=87=E6=B3=A8=E5=8F=96?= =?UTF-8?q?=E7=A7=91=E7=9B=AE=E6=98=A0=E5=B0=84=E8=A1=A8=EF=BC=9A=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0/=E8=B4=A6=E5=8D=95=E9=A1=B9=E7=9B=AE=E9=94=AE?= =?UTF-8?q?=E5=81=9A=E5=A4=A7=E5=B0=8F=E5=86=99=E4=B8=8E=E7=A9=BA=E6=A0=BC?= =?UTF-8?q?=E5=BD=92=E4=B8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 科目映射表里平台写「唯品会JX」,页签内部键是「唯品会jx」,此前按原样索引匹配不到; 改为统一小写去空格后索引与查找(其它平台如唯品会MP/阿里巴巴不受影响)。 --- .../Services/AccountLedgerRemarkMap.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/modules/EcommerceFinance/Services/AccountLedgerRemarkMap.php b/modules/EcommerceFinance/Services/AccountLedgerRemarkMap.php index 2cecbefb..b7853f5f 100644 --- a/modules/EcommerceFinance/Services/AccountLedgerRemarkMap.php +++ b/modules/EcommerceFinance/Services/AccountLedgerRemarkMap.php @@ -311,7 +311,8 @@ class AccountLedgerRemarkMap if ($platform === '' || $item === '') { continue; } - $index[$platform][$item][] = $rule; + // 平台/账单项目做大小写与空格归一:映射表里写的是「唯品会JX」,页签内部键是「唯品会jx」 + $index[$this->normalizeKey($platform)][$this->normalizeKey($item)][] = $rule; } } catch (Throwable) { $index = []; @@ -323,7 +324,7 @@ class AccountLedgerRemarkMap /** 同平台同账单项目的「财务备注」;没有规则或财务备注为空时返回 null(由调用方回落)。 */ private function accountMappingRemark(string $platform, string $item, array $businessRemarks, string $goodsName): ?string { - $rules = $this->accountMappingIndex()[$platform][$item] ?? []; + $rules = $this->accountMappingIndex()[$this->normalizeKey($platform)][$this->normalizeKey($item)] ?? []; if ($rules === []) { return null; } @@ -346,6 +347,11 @@ class AccountLedgerRemarkMap return $remark === '' ? null : $remark; } + private function normalizeKey(string $value): string + { + return mb_strtolower(preg_replace('/\s+/u', '', $value) ?? $value); + } + /** * 给一行账单补上 payload.ledger_remark(内部字段名 ledger_remark)。 *