feat(queue): add run_id for batch activation job traceability
This commit is contained in:
@@ -52,6 +52,9 @@ class BatchActivateSubscriptionsJob implements ShouldQueue
|
||||
|
||||
public function handle(SubscriptionActivationService $service): void
|
||||
{
|
||||
// 批次号:用于把一次队列批量执行关联起来,便于后续追溯/筛选/可观测。
|
||||
$runId = 'BAS' . now()->format('YmdHis') . str_pad((string) random_int(1, 9999), 4, '0', STR_PAD_LEFT);
|
||||
|
||||
foreach ($this->orderIds as $orderId) {
|
||||
/** @var PlatformOrder|null $order */
|
||||
$order = PlatformOrder::query()->find($orderId);
|
||||
@@ -81,7 +84,8 @@ class BatchActivateSubscriptionsJob implements ShouldQueue
|
||||
'admin_id' => $this->adminId,
|
||||
'subscription_id' => $subscription->id,
|
||||
'filters' => $this->filterSummary,
|
||||
'note' => '批量同步订阅(queue, limit=' . $this->limit . ', matched=' . $this->matchedTotal . ', processed=' . $this->processed . ')',
|
||||
'run_id' => $runId,
|
||||
'note' => '批量同步订阅(queue, run_id=' . $runId . ', limit=' . $this->limit . ', matched=' . $this->matchedTotal . ', processed=' . $this->processed . ')',
|
||||
];
|
||||
data_set($meta, 'audit', $audit);
|
||||
|
||||
@@ -91,6 +95,7 @@ class BatchActivateSubscriptionsJob implements ShouldQueue
|
||||
'admin_id' => $this->adminId,
|
||||
'scope' => $this->scope,
|
||||
'mode' => 'queue',
|
||||
'run_id' => $runId,
|
||||
]);
|
||||
|
||||
$order->meta = $meta;
|
||||
|
||||
Reference in New Issue
Block a user