From 344c911a119ffaf4e17a4bfd30bb712f2e6eb485 Mon Sep 17 00:00:00 2001 From: limeng <1131177064@qq.com> Date: Wed, 2 Dec 2026 14:49:16 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=90=8C=E6=AD=A5=E4=BF=9D=E7=95=99?= =?UTF-8?q?=E6=97=A7=E6=98=8E=E7=BB=86=E6=97=B6=E4=BF=9D=E6=8C=81=E7=A1=AE?= =?UTF-8?q?=E8=AE=A4=E7=9B=AE=E7=9A=84=E5=9C=B0=20(#1654)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/Jushuitan/ShippingReplicaSynchronizer.php | 1 + tests/Feature/Business/ShippingWeightPrecisionTest.php | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/modules/EcommerceFinance/Services/Jushuitan/ShippingReplicaSynchronizer.php b/modules/EcommerceFinance/Services/Jushuitan/ShippingReplicaSynchronizer.php index fed550b28..369833b26 100644 --- a/modules/EcommerceFinance/Services/Jushuitan/ShippingReplicaSynchronizer.php +++ b/modules/EcommerceFinance/Services/Jushuitan/ShippingReplicaSynchronizer.php @@ -3593,6 +3593,7 @@ class ShippingReplicaSynchronizer /** 因商品/金额无法安全替换而保留的旧包裹:包裹级字段(省市区、快递、仓库、店铺等)仍按本次上游刷新,商品与金额不动。 */ private function refreshRetainedPackages(array $refresh, array $previous): void { + $refresh = app(ShippingWeightPrecision::class)->shipmentRows($refresh); foreach ($refresh as $id => $new) { $set = []; foreach (self::REFRESHED_PACKAGE_FIELDS as $field) { diff --git a/tests/Feature/Business/ShippingWeightPrecisionTest.php b/tests/Feature/Business/ShippingWeightPrecisionTest.php index 383bbb0e4..b1429251e 100644 --- a/tests/Feature/Business/ShippingWeightPrecisionTest.php +++ b/tests/Feature/Business/ShippingWeightPrecisionTest.php @@ -49,6 +49,14 @@ class ShippingWeightPrecisionTest extends FeatureTestCase $this->assertSame('江苏',$rows[0]['receiver_state']); $this->assertNull($rows[2]['online_weight']); $this->assertArrayNotHasKey('receiver_state',$rows[2]); + $db->table('jst_oms_shipping')->insert(['source_id'=>1,'sku_source_id'=>1,'express_no'=>'TEST10001', + 'express_name1'=>'测试快递','ship_time'=>'2026-11-30','receiver_state'=>'旧省']); + $factory=$this->createMock(UpstreamReadOnlyQueryFactory::class); + $factory->method('forSource')->willReturn($this->createMock(UpstreamReadOnlyQuery::class)); + $sync=new ShippingReplicaSynchronizer($factory); + $method=new \ReflectionMethod($sync,'refreshRetainedPackages'); + $method->invoke($sync,[1=>array_replace($base,['receiver_state'=>'错误省'])],[]); + $this->assertSame('江苏',$db->table('jst_oms_shipping')->where('source_id',1)->value('receiver_state')); } public function test_alignment_keeps_confirmed_tiny_weight_on_the_primary_row(): void