diff --git a/resources/views/admin/platform_orders/index.blade.php b/resources/views/admin/platform_orders/index.blade.php index 30e7ea2..d3b8097 100644 --- a/resources/views/admin/platform_orders/index.blade.php +++ b/resources/views/admin/platform_orders/index.blade.php @@ -771,17 +771,41 @@ @php $syncErrMsg = (string) (data_get($order->meta, 'subscription_activation_error.message') ?? ''); $syncErrTooLong = $syncErrMsg !== '' && mb_strlen($syncErrMsg) > $SYNC_ERROR_KEYWORD_LINK_MAX_LEN; + + $bmpaErrMsg = (string) (data_get($order->meta, 'batch_mark_paid_and_activate_error.message') ?? ''); + $bmpaErrTooLong = $bmpaErrMsg !== '' && mb_strlen($bmpaErrMsg) > $SYNC_ERROR_KEYWORD_LINK_MAX_LEN; + + $hasAnyErr = ($syncErrMsg !== '') || ($bmpaErrMsg !== ''); @endphp - @if($syncErrMsg !== '') - @if($syncErrTooLong) - {{ mb_substr($syncErrMsg, 0, $SYNC_FAILED_REASON_TRUNCATE_LEN) }} -
原因过长,请复制到筛选框
- 进入同步失败集合 - @else - {{ mb_substr($syncErrMsg, 0, $SYNC_FAILED_REASON_TRUNCATE_LEN) }} - @endif - @else + + @if(! $hasAnyErr) - + @else + @if($syncErrMsg !== '') +
+ 同步: + @if($syncErrTooLong) + {{ mb_substr($syncErrMsg, 0, $SYNC_FAILED_REASON_TRUNCATE_LEN) }} +
原因过长,请复制到筛选框
+ 进入同步失败集合 + @else + {{ mb_substr($syncErrMsg, 0, $SYNC_FAILED_REASON_TRUNCATE_LEN) }} + @endif +
+ @endif + + @if($bmpaErrMsg !== '') +
+ BMPA: + @if($bmpaErrTooLong) + {{ mb_substr($bmpaErrMsg, 0, $SYNC_FAILED_REASON_TRUNCATE_LEN) }} +
原因过长,请复制到筛选框
+ 进入批量标记支付失败集合 + @else + {{ mb_substr($bmpaErrMsg, 0, $SYNC_FAILED_REASON_TRUNCATE_LEN) }} + @endif +
+ @endif @endif diff --git a/tests/Feature/AdminPlatformOrderRowBmpaErrorLinkTest.php b/tests/Feature/AdminPlatformOrderRowBmpaErrorLinkTest.php new file mode 100644 index 0000000..c99f5f3 --- /dev/null +++ b/tests/Feature/AdminPlatformOrderRowBmpaErrorLinkTest.php @@ -0,0 +1,72 @@ +seed(); + + $this->post('/admin/login', [ + 'email' => 'platform.admin@demo.local', + 'password' => 'Platform@123456', + ])->assertRedirect('/admin'); + } + + public function test_row_bmpa_error_message_is_clickable_to_filter_by_bmpa_error_keyword(): void + { + $this->loginAsPlatformAdmin(); + + $merchant = Merchant::query()->firstOrFail(); + $plan = Plan::query()->create([ + 'code' => 'row_bmpa_error_link_plan', + 'name' => '行BMPA失败原因链接测试套餐', + 'billing_cycle' => 'monthly', + 'price' => 10, + 'list_price' => 10, + 'status' => 'active', + 'sort' => 10, + 'published_at' => now(), + ]); + + $reason = '回执总额与应付金额不一致'; + + PlatformOrder::query()->create([ + 'merchant_id' => $merchant->id, + 'plan_id' => $plan->id, + 'order_no' => 'PO_ROW_BMPA_ERR_0001', + 'order_type' => 'new_purchase', + 'status' => 'pending', + 'payment_status' => 'unpaid', + 'plan_name' => $plan->name, + 'billing_cycle' => $plan->billing_cycle, + 'period_months' => 1, + 'quantity' => 1, + 'payable_amount' => 10, + 'paid_amount' => 0, + 'placed_at' => now(), + 'meta' => [ + 'batch_mark_paid_and_activate_error' => [ + 'message' => $reason, + 'at' => now()->toDateTimeString(), + 'admin_id' => 1, + ], + ], + ]); + + $res = $this->get('/admin/platform-orders'); + $res->assertOk(); + + $res->assertSee('BMPA:'); + $res->assertSee('/admin/platform-orders?bmpa_error_keyword=' . urlencode($reason), false); + } +}