stores = $stores; } /** * Execute the job. * * @param StoreService $service * @return void * @throws */ public function handle(StoreService $service) { if (!$this->stores)return; $errors = []; foreach ($this->stores as $store){ try{ $service->createInstantBill($store); }catch (\Error|\Exception $e){ LogService::log(__METHOD__,"ERROR-入库生成即时账单",(is_subclass_of($store,Model::class) ? $store->toJson() : json_encode($this->stores))." | ".$e->getMessage()); $errors = ["store_".$store->id.":".$e->getMessage()]; } } if ($errors)throw new \Exception(json_encode($errors)); } }