Files
saasshop/app/Support/BatchDispatchWarning.php

37 lines
1.2 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
namespace App\Support;
class BatchDispatchWarning
{
/**
* @return array{warning:string, warning_link_href?:string, warning_link_label?:string, warning_copy_text?:string, warning_copy_label?:string}
*/
public static function build(
string $actionLabel,
string $runId,
string $batchType,
): array {
$actionLabel = trim((string) $actionLabel);
$runId = trim((string) $runId);
$batchType = trim((string) $batchType);
$msg = '检测到刚刚已提交过同一批次的' . $actionLabel . '任务1 分钟内)。为避免重复投递,本次未再次提交。';
if ($runId === '') {
return AdminFlash::warning($msg);
}
$short = RunId::short($runId, $batchType === 'bmpa' ? 7 : 6, 4);
$msg = '检测到刚刚已提交过同一批次的' . $actionLabel . '任务1 分钟内run_id=' . $short . ')。为避免重复投递,本次未再次提交。';
return AdminFlash::warning(
$msg,
'/admin/platform-batches/show?type=' . $batchType . '&run_id=' . urlencode($runId),
'进入上次批次复盘',
$runId,
'复制run_id',
);
}
}