我有三个 Laravel Parent 工作名称
AutoPOChargeCalculation::dispatch($invoice_id, $user_id, $notify)->onQueue('invoice');
AutoSOChargeCalculation::dispatch($invoice_id, $user_id, $notify)->onQueue('invoice');
AutoSPChargeCalculation::dispatch($invoice_id, $user_id, $notify)->onQueue('invoice');
他们每个人都用 for 循环调用子作业
foreach ($objects as $object) {
$jobs[] = new CalculateSingleSaleOrderCharge($model, $object, $user_id, $notify, $i, $total_objects);
$i ++;
}
Bus::chain($jobs)->onQueue('invoice')->dispatch();
}
foreach ($objects as $object) {
$jobs[] = new CalculateSinglePurchaseOrderCharge($model, $object, $user_id, $notify, $i, $total_objects);
$i ++;
}
Bus::chain($jobs)->onQueue('invoice')->dispatch();
}
foreach ($objects as $object) {
$jobs[] = new CalculateSingleStoragePeriodCharge($model, $object, $user_id, $notify, $i, $total_objects);
$i ++;
}
Bus::chain($jobs)->onQueue('invoice')->dispatch();
}
现在我正在考虑删除父工作并链接所有子工作总线
Bus::chain($jobs)->onQueue('invoice')->dispatch()->withChain(
Bus::chain($jobs)->onQueue('invoice')->dispatch())->withChain(
Bus::chain($jobs)->onQueue('invoice')->dispatch());
Is that Possible?