diff --git a/resources/views/admin/dashboard.blade.php b/resources/views/admin/dashboard.blade.php index 0be445e..efee177 100644 --- a/resources/views/admin/dashboard.blade.php +++ b/resources/views/admin/dashboard.blade.php @@ -363,6 +363,9 @@ @if($syncReasonUrl !== '') 同原因集合 + @elseif($syncErrMsg !== '') + + 原因过长 @endif 查看失败详情 @@ -376,6 +379,9 @@ @if($bmpaReasonUrl !== '') 同原因集合 + @elseif($bmpaErrMsg !== '') + + 原因过长 @endif 查看失败详情 diff --git a/tests/Feature/AdminDashboardRecentPlatformOrdersFailedHintsShouldShowReasonTooLongHintWhenNoSameReasonLinkTest.php b/tests/Feature/AdminDashboardRecentPlatformOrdersFailedHintsShouldShowReasonTooLongHintWhenNoSameReasonLinkTest.php new file mode 100644 index 0000000..346b4e2 --- /dev/null +++ b/tests/Feature/AdminDashboardRecentPlatformOrdersFailedHintsShouldShowReasonTooLongHintWhenNoSameReasonLinkTest.php @@ -0,0 +1,91 @@ +seed(); + + $this->post('/admin/login', [ + 'email' => 'platform.admin@demo.local', + 'password' => 'Platform@123456', + ])->assertRedirect('/admin'); + } + + public function test_dashboard_recent_platform_orders_failed_hints_should_show_reason_too_long_hint_when_no_same_reason_link(): void + { + $this->loginAsPlatformAdmin(); + + $merchantId = (int) Merchant::query()->value('id'); + $platformAdminId = (int) Admin::query()->where('email', 'platform.admin@demo.local')->value('id'); + + $plan = Plan::query()->create([ + 'code' => 'dash_failed_reason_too_long_plan', + 'name' => '仪表盘原因过长提示测试套餐', + 'billing_cycle' => 'monthly', + 'price' => 10, + 'list_price' => 10, + 'status' => 'active', + 'sort' => 10, + 'published_at' => now(), + ]); + + $longReason = str_repeat('A', 120); + + PlatformOrder::query()->create([ + 'merchant_id' => $merchantId, + 'plan_id' => $plan->id, + 'site_subscription_id' => null, + 'created_by_admin_id' => $platformAdminId ?: null, + 'order_no' => 'PO_DASH_SYNC_FAIL_LONG_REASON_0001', + 'order_type' => 'new_purchase', + 'status' => 'pending', + 'payment_status' => 'paid', + 'payable_amount' => 10, + 'paid_amount' => 10, + 'meta' => [ + 'subscription_activation_error' => [ + 'message' => $longReason, + ], + ], + ]); + + PlatformOrder::query()->create([ + 'merchant_id' => $merchantId, + 'plan_id' => $plan->id, + 'site_subscription_id' => null, + 'created_by_admin_id' => $platformAdminId ?: null, + 'order_no' => 'PO_DASH_BMPA_FAIL_LONG_REASON_0001', + 'order_type' => 'new_purchase', + 'status' => 'pending', + 'payment_status' => 'unpaid', + 'payable_amount' => 10, + 'paid_amount' => 0, + 'meta' => [ + 'batch_mark_paid_and_activate_error' => [ + 'message' => $longReason, + ], + ], + ]); + + $res = $this->get('/admin'); + $res->assertOk(); + + // 原因过长时不生成同原因集合链接,但应提示“原因过长”避免运营以为缺入口。 + $res->assertSee('原因过长', false); + + // 不应出现同原因集合链接 + $res->assertDontSee('同原因集合', false); + } +}