feat(batch): Top失败原因行支持一键按原因治理链接
This commit is contained in:
@@ -21,6 +21,11 @@
|
||||
|
||||
$fallbackMatched = (int) (data_get($fallbackCounts, 'matched') ?? 0);
|
||||
$fallbackFailed = (int) (data_get($fallbackCounts, 'failed') ?? 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
|
||||
|
||||
<div class="card mb-20">
|
||||
@@ -106,9 +111,43 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
@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::withBack('/admin/platform-orders?' . \Illuminate\Support\Arr::query([
|
||||
'batch_activation_run_id' => $runId,
|
||||
'sync_status' => 'failed',
|
||||
'sync_error_keyword' => $reason,
|
||||
]), $safeBackForLinks);
|
||||
}
|
||||
if ($type === 'bmpa') {
|
||||
$reasonGovUrl = \App\Support\BackUrl::withBack('/admin/platform-orders?' . \Illuminate\Support\Arr::query([
|
||||
'batch_bmpa_run_id' => $runId,
|
||||
'bmpa_failed_only' => '1',
|
||||
'bmpa_error_keyword' => $reason,
|
||||
]), $safeBackForLinks);
|
||||
}
|
||||
}
|
||||
@endphp
|
||||
<tr>
|
||||
<td>{{ (string) (data_get($r, 'reason') ?? '-') }}</td>
|
||||
<td>{{ (int) (data_get($r, 'count') ?? 0) }}</td>
|
||||
<td>
|
||||
@if($reasonGovUrl !== '')
|
||||
<a class="link" data-role="batch-top-reason-link" href="{{ $reasonGovUrl }}" title="按该原因筛选">{{ $reasonDisplay }}</a>
|
||||
@else
|
||||
<span title="{{ $reason }}">{{ $reasonDisplay !== '' ? $reasonDisplay : '-' }}</span>
|
||||
@if($reasonTooLong)
|
||||
<div class="muted muted-xs text-danger">原因过长,请复制到列表页筛选框</div>
|
||||
@endif
|
||||
@endif
|
||||
</td>
|
||||
<td>{{ $cnt }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
|
||||
Reference in New Issue
Block a user