@extends('admin.layouts.app') @section('title', '批次详情') @section('page_title', '批次详情') @section('content') @php $typeText = $type === 'bas' ? 'BAS(批量同步订阅)' : ($type === 'bmpa' ? 'BMPA(批量标记支付并生效)' : '未知'); $selfWithoutBack = \App\Support\BackUrl::selfWithoutBack(); $backToListUrl = $safeBackForLinks !== '' ? $safeBackForLinks : '/admin/platform-orders'; $hasSummary = $summary !== null; $success = (int) (data_get($summary, 'success') ?? 0); $failed = (int) (data_get($summary, 'failed') ?? 0); $matched = (int) (data_get($summary, 'matched') ?? 0); $processed = (int) (data_get($summary, 'processed') ?? 0); $at = (string) (data_get($summary, 'at') ?? ''); $topReasons = (array) (data_get($summary, 'top_reasons', []) ?? []); $fallbackMatched = (int) (data_get($fallbackCounts, 'matched') ?? 0); $fallbackFailed = (int) (data_get($fallbackCounts, 'failed') ?? 0); $matchedForRatio = $hasSummary ? $matched : $fallbackMatched; $failedForRatio = $hasSummary ? $failed : $fallbackFailed; $failedRatioPct = $matchedForRatio > 0 ? round(($failedForRatio / $matchedForRatio) * 100, 1) : 0.0; $SYNC_ERROR_KEYWORD_LINK_MAX_LEN = (int) config('saasshop.platform_orders.sync_error_keyword_link_max_len', 200); $SYNC_ERROR_KEYWORD_LINK_MAX_LEN = max(50, min(1000, $SYNC_ERROR_KEYWORD_LINK_MAX_LEN)); $SYNC_FAILED_REASON_TRUNCATE_LEN = (int) config('saasshop.platform_orders.sync_failed_reason_display_truncate_len', 60); $SYNC_FAILED_REASON_TRUNCATE_LEN = max(20, min(200, $SYNC_FAILED_REASON_TRUNCATE_LEN)); @endphp

{{ $typeText }} 批次详情

run_id:{{ $runId ?: '-' }}
@if($at !== '')
更新时间:{{ $at }}
@endif
返回上一页 @if(($error ?? '') === '' && $runId !== '') @endif 刷新
@if(($error ?? '') !== '')
{{ $error }}
@else @if(! $hasSummary)
本批次尚未生成 last_result 汇总(可能队列任务仍在执行,或历史数据未补齐)。 当前页面展示的是基于同批次订单的粗略统计,供运营先行定位。
@endif

命中

@if(($governanceLinks['all'] ?? '') !== '') {{ $hasSummary ? $matched : $fallbackMatched }} @else {{ $hasSummary ? $matched : $fallbackMatched }} @endif

本次处理

@if($hasSummary && ($governanceLinks['all'] ?? '') !== '') {{ $processed }} @else {{ $hasSummary ? $processed : '-' }} @endif

成功 / 失败

提示:点击数字可进入对应集合(成功=可抽样复核)。
@if($hasSummary) @php $successLink = (string) ($governanceLinks['success'] ?? ($governanceLinks['all'] ?? '')); @endphp @if($successLink !== '') {{ $success }} @else {{ $success }} @endif / @if(($governanceLinks['failed'] ?? '') !== '') {{ $failed }} @else {{ $failed }} @endif @else - / @if(($governanceLinks['failed'] ?? '') !== '') {{ $fallbackFailed }} @else {{ $fallbackFailed }} @endif @endif
@if(($governanceLinks['failed'] ?? '') !== '' && $matchedForRatio > 0)
失败占比: {{ $failedRatioPct }}% ({{ $failedForRatio }}/{{ $matchedForRatio }})
@endif

抽样复核

@if(($spotCheck['url'] ?? '') !== '')
{{ $spotCheck['label'] ?? '抽样复核' }} @if(($spotCheck['order_id'] ?? 0) > 0) @endif (从本批次成功集合抽一单,用于 spot-check) @if(($spotCheck['order_id'] ?? 0) > 0) @php $spotPickNextUrl = '/admin/platform-batches/show?' . \Illuminate\Support\Arr::query([ 'type' => $type, 'run_id' => $runId, 'spot_after_id' => (int) ($spotCheck['order_id'] ?? 0), ]); $spotPickNextUrl = \App\Support\BackUrl::withBack($spotPickNextUrl, $safeBackForLinks); @endphp 换一单 @php $spotAfterId = (int) request()->query('spot_after_id', 0); @endphp @if($spotAfterId > 0) @php $spotPickResetUrl = '/admin/platform-batches/show?' . \Illuminate\Support\Arr::query([ 'type' => $type, 'run_id' => $runId, ]); $spotPickResetUrl = \App\Support\BackUrl::withBack($spotPickResetUrl, $safeBackForLinks); @endphp 回到最新 @endif @endif
@else
暂无可抽样订单(可能暂无成功单,或 last_result 尚未补齐)。
@endif

一键治理入口

说明:当前批次为“冗余写入到每条订单 meta.last_result”的模式;后续可演进为独立批次表。

Top 失败原因

@if(! $hasSummary)
暂无(last_result 未写入时不做原因聚合,以免在页面侧引入重查询)。
@elseif(count($topReasons) === 0)
暂无。
@else @foreach($topReasons as $r) @php $reason = (string) (data_get($r, 'reason') ?? ''); $cnt = (int) (data_get($r, 'count') ?? 0); $reasonTooLong = mb_strlen($reason) > $SYNC_ERROR_KEYWORD_LINK_MAX_LEN; $reasonDisplay = $reasonTooLong ? (mb_substr($reason, 0, $SYNC_FAILED_REASON_TRUNCATE_LEN) . '...') : $reason; $reasonGovUrl = ''; if (! $reasonTooLong && $reason !== '') { if ($type === 'bas') { $reasonGovUrl = \App\Support\BackUrl::withBackAndFragment('/admin/platform-orders?' . \Illuminate\Support\Arr::query([ 'batch_activation_run_id' => $runId, 'sync_status' => 'failed', 'sync_error_keyword' => $reason, ]), $safeBackForLinks, 'filters'); } if ($type === 'bmpa') { $reasonGovUrl = \App\Support\BackUrl::withBackAndFragment('/admin/platform-orders?' . \Illuminate\Support\Arr::query([ 'batch_bmpa_run_id' => $runId, 'bmpa_failed_only' => '1', 'bmpa_error_keyword' => $reason, ]), $safeBackForLinks, 'filters'); } } @endphp @endforeach
原因 次数
@if($reasonGovUrl !== '') {{ $reasonDisplay }} @else {{ $reasonDisplay !== '' ? $reasonDisplay : '-' }} @if($reasonTooLong)
原因过长,请复制到列表页筛选框
@endif @endif
{{ $cnt }}
@endif
@endif @endsection