{$beforeMethod}($jobData); if ($isJobStillNeedToBeDone) { $job->delete(); return; } } if (method_exists($this, $doDefaultJod)) { $isJobDone = $this->{$doDefaultJod}($jobData); if ($isJobDone) { $job->delete(); return; } else { if ($job->attempts() > $errorTimes && $errorTimes) { $job->delete(); return; } else { $job->release($release); } } } } public function doDefaultJod($data): bool { try { [$order, $formId] = $data; Db::name('cache')->insert(['key'=>'test_'.rand(10,20),'result'=>json_encode($order)]); event('OrderPaySuccess', [$order, $formId]); } catch (\Throwable $e) { } return true; } }