feat(bas): dispatch阶段生成run_id并透传到job便于复盘

This commit is contained in:
萝卜
2026-03-17 18:04:14 +08:00
parent 7f1f5a6887
commit e1d5cee52e
2 changed files with 15 additions and 2 deletions

View File

@@ -1620,6 +1620,10 @@ class PlatformOrderController extends Controller
return redirect()->back()->with('warning', '检测到刚刚已提交过同一批次的 BAS 任务1 分钟内)。为避免重复投递,本次未再次提交。');
}
// run_id用于把一次批量执行关联起来便于后续追溯/筛选/可观测。
// 说明run_id 在投递阶段就生成,这样运营在页面成功提示里即可复制 run_id 并进入批次复盘页。
$runId = 'BAS' . now()->format('YmdHis') . str_pad((string) random_int(1, 9999), 4, '0', STR_PAD_LEFT);
\App\Jobs\BatchActivateSubscriptionsJob::dispatch(
$orderIds,
(int) $admin->id,
@@ -1628,9 +1632,10 @@ class PlatformOrderController extends Controller
(int) $limit,
(int) $matchedTotal,
(int) $processed,
(string) $runId,
);
return redirect()->back()->with('success', '批量同步订阅任务已提交到队列:命中 ' . $matchedTotal . ' 条,本次处理 ' . $processed . ' 条limit=' . $limit . ')。');
return redirect()->back()->with('success', '批量同步订阅任务已提交到队列:命中 ' . $matchedTotal . ' 条,本次处理 ' . $processed . ' 条limit=' . $limit . 'run_id=' . $runId . ')。');
}
public function batchMarkPaidAndActivate(Request $request, SubscriptionActivationService $service): RedirectResponse