data = $data; } public function handle() { try { list($bool, $msg) = $this->settle(); if(! $bool) $this->finalDo($msg); } catch (\Throwable $e) { $this->finalDo("异常:" . $e->getMessage()); $this->delete(); } } private function finalDo($msg){ $data = $this->data; EnterpriseRecord::where('sp_no', $data['sp_no']) ->update(['result' => $msg]); } private function settle() { $data = $this->data; try { $no = $data['sp_no']; $template_id = $data['template_id']; $service = new EnterpriseWechatService(); $detail = $service->getOA()->approvalDetail($no); //todo } catch (\Throwable $e) { return [false, $e->getMessage()]; } return [true, '']; } protected function echoMessage(OutputInterface $output) { //输出消息 $output->writeln(json_encode($this->data)); } }