审计记录:快照列支持降级展示 filters/subscription_id
This commit is contained in:
@@ -452,7 +452,24 @@
|
||||
@if($snapPaid !== null || $snapRefund !== null)
|
||||
paid=¥{{ number_format((float) ($snapPaid ?? 0), 2) }};refund=¥{{ number_format((float) ($snapRefund ?? 0), 2) }}
|
||||
@else
|
||||
-
|
||||
@php
|
||||
$subId = data_get($item, 'subscription_id');
|
||||
$filtersText = (string) (data_get($item, 'filters') ?? '');
|
||||
$filtersText = $filtersText !== '' ? mb_substr($filtersText, 0, 80) : '';
|
||||
@endphp
|
||||
@if($subId || $filtersText !== '')
|
||||
@if($subId)
|
||||
subscription_id={{ $subId }}
|
||||
@endif
|
||||
@if($subId && $filtersText !== '')
|
||||
;
|
||||
@endif
|
||||
@if($filtersText !== '')
|
||||
filters={{ $filtersText }}
|
||||
@endif
|
||||
@else
|
||||
-
|
||||
@endif
|
||||
@endif
|
||||
</td>
|
||||
<td class="muted">{{ data_get($item, 'note') ?: '' }}</td>
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Models\Merchant;
|
||||
use App\Models\Plan;
|
||||
use App\Models\PlatformOrder;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class AdminPlatformOrderAuditSnapshotFallbackRenderTest 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_show_page_can_render_audit_snapshot_fallback_fields(): void
|
||||
{
|
||||
$this->loginAsPlatformAdmin();
|
||||
|
||||
$merchant = Merchant::query()->firstOrFail();
|
||||
$plan = Plan::query()->create([
|
||||
'code' => 'audit_snapshot_fallback_plan_01',
|
||||
'name' => '审计快照降级展示测试',
|
||||
'billing_cycle' => 'monthly',
|
||||
'price' => 10,
|
||||
'list_price' => 10,
|
||||
'status' => 'active',
|
||||
'sort' => 10,
|
||||
'published_at' => now(),
|
||||
]);
|
||||
|
||||
$order = PlatformOrder::query()->create([
|
||||
'merchant_id' => $merchant->id,
|
||||
'plan_id' => $plan->id,
|
||||
'order_no' => 'PO_AUDIT_SNAPSHOT_FALLBACK_0001',
|
||||
'order_type' => 'new_purchase',
|
||||
'status' => 'activated',
|
||||
'payment_status' => 'paid',
|
||||
'plan_name' => $plan->name,
|
||||
'billing_cycle' => $plan->billing_cycle,
|
||||
'period_months' => 1,
|
||||
'quantity' => 1,
|
||||
'payable_amount' => 10,
|
||||
'paid_amount' => 10,
|
||||
'placed_at' => now(),
|
||||
'paid_at' => now(),
|
||||
'activated_at' => now(),
|
||||
'meta' => [
|
||||
'audit' => [
|
||||
[
|
||||
'action' => 'batch_activate_subscription',
|
||||
'scope' => 'filtered',
|
||||
'at' => now()->toDateTimeString(),
|
||||
'admin_id' => 1,
|
||||
'subscription_id' => 123,
|
||||
'filters' => 'syncable_only=1&refund_inconsistent=1',
|
||||
'note' => '测试用审计记录',
|
||||
],
|
||||
],
|
||||
],
|
||||
]);
|
||||
|
||||
$this->get('/admin/platform-orders/' . $order->id)
|
||||
->assertOk()
|
||||
->assertSee('subscription_id=123')
|
||||
->assertSee('filters=syncable_only=1');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user