data = $data; $this->user = $user; } public function handle() { try { $data = $this->data; $user = $this->user; $type = $data['type']; if($type == 'p_work'){ $service = new PersonWorkService(); list($status,$msg) = $service->dailyPwOrderCreateMain($data, $user); }elseif ($type == 'd_work'){ $service = new DeviceWorkService(); list($status,$msg) = $service->dailyDwOrderCreateMain($data, $user); } if(isset($status) && isset($msg)) $this->finalDo($msg); } catch (\Throwable $e) { $this->finalDo("异常:" . $e->getMessage()); $this->delete(); } } private function finalDo($msg){ $user = $this->user; $data = $this->data; DB::table('error_record')->insert([ 'result' => $msg, 'crt_id' => $user['id'], 'crt_time' => time(), 'order_type' => $data['type'], ]); } protected function echoMessage(OutputInterface $output) { //输出消息 $output->writeln(json_encode($this->data)); } }