orders = $orders; } /** * * @param OrderService $service * @return void * @throws */ public function handle(OrderService $service) { if ($this->orders){ $errors = []; foreach ($this->orders as $order){ try{ if (!$service->createInstantBill($order)) $this->push(__METHOD__."->".__LINE__,"订单生成即时账单",$order->toJson()); }catch(QueryException $qe){ if ($qe->getCode()!='23000'){ $this->push(__METHOD__."->".__LINE__,"订单生成即时账单",$order->toJson()." | ".$qe->getMessage()); $errors = ["order_".$order->id.":".$qe->getMessage()]; } }catch (\Exception $e){ $this->push(__METHOD__."->".__LINE__,"订单生成即时账单",$order->toJson()." | ".$e->getMessage()); $errors = ["order_".$order->id.":".$e->getMessage()]; } } if ($errors)throw new \Exception(json_encode($errors)); } } }