From 38179ea6d759b59373a158b8651e9b26ca4e83a3 Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 4 Feb 2021 11:59:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20k5=E5=B7=9D=E6=97=A5?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E7=89=A9=E6=B5=81=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/platforms/K5Platform.php | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/src/platforms/K5Platform.php b/src/platforms/K5Platform.php index 9bff43a..1003224 100644 --- a/src/platforms/K5Platform.php +++ b/src/platforms/K5Platform.php @@ -255,24 +255,15 @@ protected function formatOrder(Order $orderClass): array { $items = []; - $volumes = []; foreach ($orderClass->goods as $good) { $items[] = [ - 'Sku'=>$good->sku, // 产品 Sku (OrderType 为仓储订单必传) + 'Sku'=>is_null($good->sku)?'':$good->sku, // 产品 Sku (OrderType 为仓储订单必传) 'Cnname'=>$good->cnDescription, // 产品中文名 'Enname'=>$good->description, // 产品英文名 'Price'=>$good->worth, // 单价 'SingleWeight'=>$good->weight, // 单件重量 'Num'=>$good->quantity, // 数量 ]; - $volumes[] = [ - 'Weight'=> $good->weight, // 实重 - 'Number'=>$good->quantity, // 件数 - //'Length'=>$good->length, // 长 - //'Width'=>$good->width, // 宽 - //'Height'=> $good->height, // 高 - - ]; } @@ -287,10 +278,10 @@ protected function formatOrder(Order $orderClass): array 'TotalValue'=>$orderClass->package->declareWorth, // 订单总申报价值 'Number'=>$orderClass->package->quantity, // 件数 'Recipient'=>[ - 'Name'=>$orderClass->recipient->name, // 名称 - 'Company'=>$orderClass->recipient->company, - 'Addres1'=>$orderClass->recipient->address, // 电话 - 'Addres2'=> $orderClass->recipient->doorplate, // 电话 + 'Name'=>is_null($orderClass->recipient->name)?'':$orderClass->recipient->name, // 名称 + 'Company'=>is_null($orderClass->recipient->company)?'':$orderClass->recipient->company, + 'Addres1'=>is_null($orderClass->recipient->address)?'':$orderClass->recipient->address, // 地址1 + 'Addres2'=>is_null($orderClass->recipient->doorplate)?'':$orderClass->recipient->doorplate, // 地址2 'Tel'=> $orderClass->recipient->phone, // 电话 'Province'=>$orderClass->recipient->state, // 省州 'City'=>$orderClass->recipient->city, // 城市 @@ -298,8 +289,8 @@ protected function formatOrder(Order $orderClass): array ], 'Sender'=>[ 'Name'=>$orderClass->shipper->name, // 名称 - 'Company'=>$orderClass->shipper->company, - 'Addres'=>$orderClass->shipper->address, // 电话 + 'Company'=>is_null($orderClass->shipper->company)?'':$orderClass->shipper->company, + 'Addres'=>is_null($orderClass->shipper->address)?'':$orderClass->shipper->address, // 地址 'Country'=> $orderClass->shipper->countryCode, // 国家 'Mobile'=> $orderClass->shipper->phone, // 电话 'Tel'=> $orderClass->shipper->phone, // 电话 @@ -310,8 +301,6 @@ protected function formatOrder(Order $orderClass): array 'OrderItems'=>$items, // 订单明细产品信息 - 'Volumes'=>$volumes, // 材积明细 (OrderType 为快递制单必传) - 'FeePayData'=>[ 'FeePayType'=>$this->FeePayType, // 支付方式[ PP:预付,CC:到付, TP:第三方]必传 ],