From c55c06026f18507527f79995d06d5662f7ad94f2 Mon Sep 17 00:00:00 2001 From: zhoushengchen <3057083327@qq.com> Date: Mon, 12 Oct 2026 17:49:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BF=AB=E9=80=92=E5=BA=94=E4=BB=98=EF=BC=9A?= =?UTF-8?q?=E6=8A=A5=E4=BB=B7=E7=BB=B4=E6=8A=A4=E5=8F=AA=E7=95=99=E6=8A=A5?= =?UTF-8?q?=E4=BB=B7=E9=A1=B5=E7=AD=BE=20+=20=E9=99=84=E5=8A=A0=E8=B4=B9?= =?UTF-8?q?=E7=BB=93=E7=AE=97=E5=AE=9A=E6=97=B6=E5=90=8C=E6=AD=A5=EF=BC=88?= =?UTF-8?q?=E6=AF=8F=E6=97=A57=E5=A4=A9/=E6=AF=8F=E5=91=A890=E5=A4=A9?= =?UTF-8?q?=EF=BC=89=20(#314)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Business/Pages.php | 14 +++-- config/business_navigation.php | 1 - deploy/activate-incremental-release.sh | 4 ++ deploy/activate-release.sh | 4 ++ .../courier-surcharge-workspace.blade.php | 60 +------------------ .../CourierSurchargeSettlementPageTest.php | 38 +++++++----- .../Deployment/BusinessMirrorScheduleTest.php | 12 ++++ 7 files changed, 53 insertions(+), 80 deletions(-) diff --git a/app/Http/Controllers/Business/Pages.php b/app/Http/Controllers/Business/Pages.php index fdded647..a765dd60 100644 --- a/app/Http/Controllers/Business/Pages.php +++ b/app/Http/Controllers/Business/Pages.php @@ -381,6 +381,14 @@ class Pages extends Controller abort_if(empty($sectionConfig), 403, '当前账号没有该页面权限。'); + // 附加费结算已独立到快递应付页面,旧页签地址跳到新页面。 + if ($section === 'courier-payables' && $page === 'courier-surcharge' && $tab === 'settlement') { + return redirect()->route('business.pages.show', array_merge(request()->query(), [ + 'section' => $section, + 'page' => 'courier-surcharge-settlement', + ])); + } + $pages = collect($sectionConfig['pages'] ?? []); if ($pages->isEmpty()) { @@ -3782,7 +3790,7 @@ class Pages extends Controller protected function contentForCourierSurcharge(?string $tab = null): array { $clean = static fn (mixed $value, int $length = 60): string => mb_substr(trim((string) $value), 0, $length); - $quoteInput = $tab === 'settlement' ? [] : request()->query(); + $quoteInput = request()->query(); $filters = [ 'keyword' => $clean($quoteInput['keyword'] ?? '', 40), 'courier' => $clean($quoteInput['courier'] ?? '', 40), @@ -3810,10 +3818,6 @@ class Pages extends Controller 'courierSurchargeAuditLogs' => $this->courierSurchargeAudits->recent(), ]; - if ($tab === 'settlement') { - $content += $this->contentForCourierSurchargeSettlement(); - } - return $content; } diff --git a/config/business_navigation.php b/config/business_navigation.php index 74252365..e45a5bf5 100644 --- a/config/business_navigation.php +++ b/config/business_navigation.php @@ -713,7 +713,6 @@ $navigation = [ 'title' => '附加费报价维护', 'tabs' => [ ['slug' => 'quotes', 'title' => '附加费报价'], - ['slug' => 'settlement', 'title' => '附加费结算'], ], ], ], diff --git a/deploy/activate-incremental-release.sh b/deploy/activate-incremental-release.sh index 1f26c98c..024c6291 100644 --- a/deploy/activate-incremental-release.sh +++ b/deploy/activate-incremental-release.sh @@ -204,6 +204,10 @@ CRON_TZ=Asia/Shanghai # 头条放心购(店铺收款账户账单 › 抖音账户)资金流水:每天 09:30 定点把该渠道所用 # 原始账单镜像追平一次,保证上班前当日/前一日流水已进系统,而不是等每分钟轮转慢慢走。 30 9 * * * root /usr/bin/flock -w 1800 /run/caiwu-upstream-sync.lock /usr/bin/docker exec -u www-data caiwu_app php artisan business-mirror:sync-tables operations_replica.rpt.jst_originalBillInfo --max-batches=20 --quiet >/dev/null 2>&1 +# 附加费结算:每天滚动重算最近 7 天;每周一再把最近 90 天全量重算一次, +# 补齐晚到的退货进仓与审批变化(超长费按出库日期、退回费/拦截费按查件工单创建时间)。 +30 6 * * * root /usr/bin/flock -w 1800 /run/caiwu-upstream-sync.lock /bin/sh -c '/usr/bin/docker exec -u www-data caiwu_app php artisan courier-surcharge:pull-overlength --days=7 --quiet; /usr/bin/docker exec -u www-data caiwu_app php artisan courier-surcharge:pull-return --days=7 --quiet' >/dev/null 2>&1 +40 6 * * 1 root /usr/bin/flock -w 3600 /run/caiwu-upstream-sync.lock /bin/sh -c '/usr/bin/docker exec -u www-data caiwu_app php artisan courier-surcharge:pull-overlength --days=90 --quiet; /usr/bin/docker exec -u www-data caiwu_app php artisan courier-surcharge:pull-return --days=90 --quiet' >/dev/null 2>&1 EOF chmod 644 /etc/cron.d/caiwu-jiansun-snapshots diff --git a/deploy/activate-release.sh b/deploy/activate-release.sh index b6bd03a5..1e437ae7 100644 --- a/deploy/activate-release.sh +++ b/deploy/activate-release.sh @@ -208,6 +208,10 @@ CRON_TZ=Asia/Shanghai # 头条放心购(店铺收款账户账单 › 抖音账户)资金流水:每天 09:30 定点把该渠道所用 # 原始账单镜像追平一次,保证上班前当日/前一日流水已进系统,而不是等每分钟轮转慢慢走。 30 9 * * * root /usr/bin/flock -w 1800 /run/caiwu-upstream-sync.lock /usr/bin/docker exec -u www-data caiwu_app php artisan business-mirror:sync-tables operations_replica.rpt.jst_originalBillInfo --max-batches=20 --quiet >/dev/null 2>&1 +# 附加费结算:每天滚动重算最近 7 天;每周一再把最近 90 天全量重算一次, +# 补齐晚到的退货进仓与审批变化(超长费按出库日期、退回费/拦截费按查件工单创建时间)。 +30 6 * * * root /usr/bin/flock -w 1800 /run/caiwu-upstream-sync.lock /bin/sh -c '/usr/bin/docker exec -u www-data caiwu_app php artisan courier-surcharge:pull-overlength --days=7 --quiet; /usr/bin/docker exec -u www-data caiwu_app php artisan courier-surcharge:pull-return --days=7 --quiet' >/dev/null 2>&1 +40 6 * * 1 root /usr/bin/flock -w 3600 /run/caiwu-upstream-sync.lock /bin/sh -c '/usr/bin/docker exec -u www-data caiwu_app php artisan courier-surcharge:pull-overlength --days=90 --quiet; /usr/bin/docker exec -u www-data caiwu_app php artisan courier-surcharge:pull-return --days=90 --quiet' >/dev/null 2>&1 EOF chmod 644 /etc/cron.d/caiwu-jiansun-snapshots diff --git a/resources/views/business/pages/courier-payables/courier-surcharge-workspace.blade.php b/resources/views/business/pages/courier-payables/courier-surcharge-workspace.blade.php index 41ce8674..e6d9dbc0 100644 --- a/resources/views/business/pages/courier-payables/courier-surcharge-workspace.blade.php +++ b/resources/views/business/pages/courier-payables/courier-surcharge-workspace.blade.php @@ -1,63 +1,5 @@ -@php - $surchargeTabUrls = collect(['quotes', 'settlement'])->mapWithKeys(fn ($tab) => [ - $tab => route('business.pages.show', ['section' => 'courier-payables', 'page' => 'courier-surcharge', 'tab' => $tab]), - ])->all(); -@endphp
- - - diff --git a/tests/Feature/Business/CourierSurchargeSettlementPageTest.php b/tests/Feature/Business/CourierSurchargeSettlementPageTest.php index e867ec5c..546af5a4 100644 --- a/tests/Feature/Business/CourierSurchargeSettlementPageTest.php +++ b/tests/Feature/Business/CourierSurchargeSettlementPageTest.php @@ -20,10 +20,8 @@ class CourierSurchargeSettlementPageTest extends FeatureTestCase $this->loginAs()->get(route('business.pages.show', [ 'section' => 'courier-payables', - 'page' => 'courier-surcharge', - 'tab' => 'settlement', + 'page' => 'courier-surcharge-settlement', ]))->assertOk() - ->assertSee('data-surcharge-panel="quotes" hidden', false) ->assertSeeText('附加费结算') ->assertSeeText('共享业务镜像尚未建立,附加费结算暂时无法读取。') ->assertSee('data-finance-table-name="courier-surcharge-settlement"', false) @@ -45,8 +43,7 @@ class CourierSurchargeSettlementPageTest extends FeatureTestCase $this->loginAs()->get(route('business.pages.show', [ 'section' => 'courier-payables', - 'page' => 'courier-surcharge', - 'tab' => 'settlement', + 'page' => 'courier-surcharge-settlement', 'courier_name' => '测试快递', 'waybill' => '001234', 'shop_name' => '测试店铺', @@ -61,7 +58,7 @@ class CourierSurchargeSettlementPageTest extends FeatureTestCase ->assertViewHas('content', fn (array $content) => $content['courierSurchargeSettlementFilters']['status'] === '已计算'); } - public function test_quote_page_exposes_quote_and_settlement_tabs(): void + public function test_quote_page_only_exposes_quote_tab(): void { $this->user->attachPermission(Permission::where('name', 'read-admin-panel')->firstOrFail()); @@ -70,18 +67,29 @@ class CourierSurchargeSettlementPageTest extends FeatureTestCase 'page' => 'courier-surcharge', ]))->assertOk() ->assertSeeText('附加费报价') - ->assertSeeText('附加费结算') - ->assertSee('data-surcharge-panel="settlement" hidden', false) - ->assertSee(route('business.pages.show', [ - 'section' => 'courier-payables', - 'page' => 'courier-surcharge', - 'tab' => 'quotes', - ]), false) - ->assertSee(route('business.pages.show', [ + ->assertDontSee(route('business.pages.show', [ 'section' => 'courier-payables', 'page' => 'courier-surcharge', 'tab' => 'settlement', - ]), false); + ]), false) + ->assertDontSee('data-surcharge-panel="settlement"', false) + ->assertSee('data-surcharge-panel="quotes"', false); + } + + public function test_old_settlement_tab_url_redirects_to_standalone_page(): void + { + $this->user->attachPermission(Permission::where('name', 'read-admin-panel')->firstOrFail()); + + $this->loginAs()->get(route('business.pages.show', [ + 'section' => 'courier-payables', + 'page' => 'courier-surcharge', + 'tab' => 'settlement', + 'waybill' => '0000123456789', + ]))->assertRedirect(route('business.pages.show', [ + 'section' => 'courier-payables', + 'page' => 'courier-surcharge-settlement', + 'waybill' => '0000123456789', + ])); } public function test_settlement_page_renders_as_courier_payables_page(): void diff --git a/tests/Unit/Deployment/BusinessMirrorScheduleTest.php b/tests/Unit/Deployment/BusinessMirrorScheduleTest.php index 256cf2f1..5da1595b 100644 --- a/tests/Unit/Deployment/BusinessMirrorScheduleTest.php +++ b/tests/Unit/Deployment/BusinessMirrorScheduleTest.php @@ -74,6 +74,18 @@ class BusinessMirrorScheduleTest extends TestCase $contents, $script, ); + $this->assertStringContainsString( + "30 6 * * * root /usr/bin/flock -w 1800 /run/caiwu-upstream-sync.lock /bin/sh -c '/usr/bin/docker exec -u www-data caiwu_app php artisan courier-surcharge:pull-overlength --days=7 --quiet; /usr/bin/docker exec -u www-data caiwu_app php artisan courier-surcharge:pull-return --days=7 --quiet'", + $contents, + $script, + ); + $this->assertStringContainsString( + "40 6 * * 1 root /usr/bin/flock -w 3600 /run/caiwu-upstream-sync.lock /bin/sh -c '/usr/bin/docker exec -u www-data caiwu_app php artisan courier-surcharge:pull-overlength --days=90 --quiet; /usr/bin/docker exec -u www-data caiwu_app php artisan courier-surcharge:pull-return --days=90 --quiet'", + $contents, + $script, + ); + $this->assertSame(2, substr_count($contents, 'courier-surcharge:pull-overlength'), $script); + $this->assertSame(2, substr_count($contents, 'courier-surcharge:pull-return'), $script); $this->assertStringContainsString( 'business-mirror:sync-third-party-warehouse-storage --max-batches=0 --quiet', $contents,