From 9461b4a5e38001b7838d51a2beb34c477513e404 Mon Sep 17 00:00:00 2001 From: WuYongJie <549727955@qq.com> Date: Tue, 4 Aug 2026 19:12:53 +0800 Subject: [PATCH 1/2] chore: start local direct read pagination fix -- 2.47.2 From 755cfb74f64b1a72b6c2660d566078cec1789bbe Mon Sep 17 00:00:00 2001 From: WuYongJie <549727955@qq.com> Date: Tue, 4 Aug 2026 19:16:48 +0800 Subject: [PATCH 2/2] fix: capture local direct read pagination --- app/Business/UpstreamBusinessInformation.php | 15 +++- .../UpstreamBusinessInformationTest.php | 76 +++++++++++++++++++ 2 files changed, 88 insertions(+), 3 deletions(-) create mode 100644 tests/Unit/EcommerceFinance/UpstreamBusinessInformationTest.php diff --git a/app/Business/UpstreamBusinessInformation.php b/app/Business/UpstreamBusinessInformation.php index 86a70b1c..53a9a4b9 100644 --- a/app/Business/UpstreamBusinessInformation.php +++ b/app/Business/UpstreamBusinessInformation.php @@ -68,7 +68,10 @@ class UpstreamBusinessInformation 'company-information.read', $page, $perPage, - fn () => $this->snapshot('company-information.read', compact('page', 'perPage')), + fn () => $this->snapshot('company-information.read', [ + 'page' => $page, + 'perPage' => $perPage, + ]), ); } @@ -109,7 +112,10 @@ SQL); 'store-information.read', $page, $perPage, - fn () => $this->snapshot('store-information.read', compact('page', 'perPage')), + fn () => $this->snapshot('store-information.read', [ + 'page' => $page, + 'perPage' => $perPage, + ]), ); } @@ -154,7 +160,10 @@ SQL); 'trademark-information.read', $page, $perPage, - fn () => $this->snapshot('trademark-information.read', compact('page', 'perPage')), + fn () => $this->snapshot('trademark-information.read', [ + 'page' => $page, + 'perPage' => $perPage, + ]), ); } diff --git a/tests/Unit/EcommerceFinance/UpstreamBusinessInformationTest.php b/tests/Unit/EcommerceFinance/UpstreamBusinessInformationTest.php new file mode 100644 index 00000000..9adc4839 --- /dev/null +++ b/tests/Unit/EcommerceFinance/UpstreamBusinessInformationTest.php @@ -0,0 +1,76 @@ +calls[] = compact('scope', 'parameters'); + + return $resolver(); + } + }; + + $caches = new class($cache) extends UpstreamQueryCacheFactory { + public function __construct(private readonly UpstreamQueryCache $cache) + { + } + + public function forSource(string $source): UpstreamQueryCache + { + return $this->cache; + } + }; + + $information = new class($caches) extends UpstreamBusinessInformation { + public array $snapshots = []; + + public function snapshot(string $scope, array $parameters): array + { + $this->snapshots[] = compact('scope', 'parameters'); + + return ['data' => [], 'total' => 0]; + } + }; + + $this->app['request']->merge(['page' => 3]); + + $paginator = $information->paginate($section, $page, 25); + $expected = ['scope' => $scope, 'parameters' => ['page' => 3, 'perPage' => 25]]; + + $this->assertSame(3, $paginator->currentPage()); + $this->assertSame($expected, $cache->calls[0]); + $this->assertSame($expected, $information->snapshots[0]); + } + + public static function businessInformationPages(): array + { + return [ + 'company' => ['company-management', 'basic-information', 'company-information.read'], + 'store' => ['store-management', 'basic-information', 'store-information.read'], + 'trademark' => ['trademark-management', 'information', 'trademark-information.read'], + ]; + } +} -- 2.47.2