dashboard: merchant revenue rank links include 7d created_at range
This commit is contained in:
@@ -149,7 +149,11 @@
|
|||||||
$mid = (int) ($row['merchant_id'] ?? 0);
|
$mid = (int) ($row['merchant_id'] ?? 0);
|
||||||
$mname = (string) (($merchantIdToName[$mid] ?? '') ?: ('#' . $mid));
|
$mname = (string) (($merchantIdToName[$mid] ?? '') ?: ('#' . $mid));
|
||||||
$merchantOrdersUrl = \App\Support\BackUrl::withBack(
|
$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
|
$selfWithoutBack
|
||||||
);
|
);
|
||||||
@endphp
|
@endphp
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Feature;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
class AdminDashboardMerchantRevenueRank7dLinkShouldIncludeDateRangeTest extends TestCase
|
||||||
|
{
|
||||||
|
use RefreshDatabase;
|
||||||
|
|
||||||
|
protected function loginAsPlatformAdmin(): void
|
||||||
|
{
|
||||||
|
$this->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);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user