diff --git a/resources/views/admin/dashboard.blade.php b/resources/views/admin/dashboard.blade.php index d4400bb..9916f0d 100644 --- a/resources/views/admin/dashboard.blade.php +++ b/resources/views/admin/dashboard.blade.php @@ -149,7 +149,11 @@ $mid = (int) ($row['merchant_id'] ?? 0); $mname = (string) (($merchantIdToName[$mid] ?? '') ?: ('#' . $mid)); $merchantOrdersUrl = \App\Support\BackUrl::withBack( - '/admin/platform-orders?' . \Illuminate\Support\Arr::query(['merchant_id' => $mid]), + '/admin/platform-orders?' . \Illuminate\Support\Arr::query([ + 'merchant_id' => $mid, + 'created_from' => now()->subDays(6)->format('Y-m-d'), + 'created_to' => now()->format('Y-m-d'), + ]), $selfWithoutBack ); @endphp diff --git a/tests/Feature/AdminDashboardMerchantRevenueRank7dLinkShouldIncludeDateRangeTest.php b/tests/Feature/AdminDashboardMerchantRevenueRank7dLinkShouldIncludeDateRangeTest.php new file mode 100644 index 0000000..8dbf521 --- /dev/null +++ b/tests/Feature/AdminDashboardMerchantRevenueRank7dLinkShouldIncludeDateRangeTest.php @@ -0,0 +1,39 @@ +seed(); + + $this->post('/admin/login', [ + 'email' => 'platform.admin@demo.local', + 'password' => 'Platform@123456', + ])->assertRedirect('/admin'); + } + + public function test_dashboard_merchant_revenue_rank_7d_link_should_include_date_range(): void + { + $this->loginAsPlatformAdmin(); + + $res = $this->get('/admin'); + $res->assertOk(); + + $from = now()->subDays(6)->format('Y-m-d'); + $to = now()->format('Y-m-d'); + + // 排行卡的站点链接应带上近7天日期范围 + back + $res->assertSee('data-role="merchant-revenue-rank-7d"', false); + $res->assertSee('created_from=' . $from, false); + $res->assertSee('created_to=' . $to, false); + $res->assertSee('back=%2Fadmin', false); + $res->assertDontSee('&back=', false); + } +}