filter(function ($item) { return in_array($item->docOrderHeader->consigneeid, ['TB', 'TMMK', 'TM']) || $item->docOrderheader['h_edi_01'] == '幼岚天猫超市'; }); return $items->map(function ($item) { return [ // TODO 需要动态获取面单获取的组件 TYPE 'type' => 'CAINIAO', // PDD 或 CAINIAO 动态 'task_id' => Str::uuid(), 'is_process' => false, 'data' => $item['userdefine1'], 'component_type' => 'TB', 'owner_code' => $item->docOrderHeader->customerid ?? '', 'logistic_code' => $item->docOrderHeader->userdefine1 ?? '', 'logistic_number' => $item['trackingno'], 'delivery' => $this->getDelivery($item), 'base64' => null, 'printerName' => '', ]; })->toArray(); } public function getBase64($item) { } function getDelivery($item): array { return $this->getDocOrderDeliveryInfo($item); } function processing(array &$item) { $item['is_process'] = true; $PrintTemplate = OwnerLogisticPrintTemplate::query()->with('printTemplate')->where('owner_id', function (Builder $query) use ($item) { $query->from('owners')->selectRaw('id')->where("code", $item['owner_code']); })->where('logistic_id', function (Builder $query) use ($item) { $query->from('logistics')->selectRaw('id')->where("code", $item['logistic_code']); })->first(); if (!$item) return $item; $path = ''; $img = $this->getImage($item['base64'], $path); app(DeliveryService::class)->pushClearCache($path); $image = $this->draw($item['delivery'], $PrintTemplate->printTemplate, $img); $this->saveImage($image, $path); $item['base64'] = $this->readImageBase64($path); app(DeliveryService::class)->pushClearCache($path); return $item; } }