runJob($method, $data); } /** * 执行任务 * @param string $method * @param array $data * @param int $error_count */ protected function runJob(string $method, array $data) { try { $method = method_exists($this, $method) ? $method : 'handle'; if (!method_exists($this, $method)) { throw new CommonException('Job "'.static::class.'" not found!'); } $this->{$method}(...$data); return true; } catch (\Throwable $e) { Log::write('队列错误:'.static::class.$method.'_'.'_'.$e->getMessage().'_'.$e->getFile().'_'.$e->getLine()); throw new CommonException('Job "'.static::class.'" has error!'); } } }