/** * OrderPrintAct::get_hsInfo() * 获取SPU报关信息 暂时拉取产品中心接口 * @param array $spus * @return void */ public function get_hsInfo($spus) { $spus = json_encode($spus); $key = 'hsInfo' . $spus; $data = WhBaseModel::cache($key); if (!$data) { $data = CommonModel::get_hsInfo($spus); if ($data['errCode'] == 200) { $data = $data['data']; WhBaseModel::cache($key, $data, 24 * 3600); } else { $data = ''; } } return $data; }
$ebay_itemid = $detail['orderDetail']['itemId']; //平台产品id $ebay_itemtitle = $detail['orderDetailExtension']['itemTitle']; $ebay_amount = $detail['orderDetail']['amount']; $ebay_itemprice = $detail['orderDetail']['itemPrice']; $sku = $sku; $ebay_tid = $detail['orderDetailExtension']['transactionID']; //交易号 $onliesku = $detail['orderDetail']['onlinesku']; $weight = 0; foreach ($detail['skuDetail']['skuInfo'] as $realskus) { $weight += $realskus['skuDetail']['goodsWeight'] * $realskus['amount']; } $weight = $weight > 0 ? $weight : 0.1; //取最后一个的报关信息 $hsinfo = CommonModel::get_hsInfo(json_encode(array($realskus['skuDetail']['spu']))); $hsinfo = $hsinfo['data'][$realskus['skuDetail']['spu']]; $goodsinfo['customsNameEN'] = $hsinfo['customsNameEN']; $goodsinfo['customsName'] = $hsinfo['customsName']; $customsNameEN = $hsinfo['customsNameEN'] ? $hsinfo['customsNameEN'] : $ebay_itemtitle; $customsName = $hsinfo['customsName'] ? $goodsinfo['customsName'] : $ebay_itemtitle; $DeclaredValue = 1; //不知从哪里获取,定义为1 if (!in_array($ebay_itemid . '-' . $ebay_tid, $unique_item_tid)) { $unique_item_tid[] = $ebay_itemid . '-' . $ebay_tid; $item[] = array('CurrencyCode' => $ebay_currency, 'EBayEmail' => $ebay_usermail, 'EBayBuyerID' => $ebay_userid, 'EBayItemID' => $ebay_itemid, 'EBayItemTitle' => $ebay_itemtitle, 'EBayMessage' => '', 'EBaySiteID' => "0", 'EBayTransactionID' => $ebay_tid, 'Note' => '', 'OrderSalesRecordNumber' => $recordnumber, 'PaymentDate' => $ebay_paidtime, 'PayPalEmail' => "0", 'PayPalMessage' => '', 'PostedQTY' => $ebay_amount, 'ReceivedAmount' => $ebay_total, 'SalesRecordNumber' => $recordnumber, 'SoldDate' => $ebay_createdtime, 'SoldPrice' => $ebay_itemprice, 'SoldQTY' => $ebay_amount, 'SKU' => array('SKUID' => $sku, 'Weight' => $weight * $ebay_amount, 'CustomsTitleCN' => $customsName, 'CustomsTitleEN' => $customsNameEN . ' ' . $sku, 'DeclaredValue' => $DeclaredValue * $ebay_amount, 'OriginCountryName' => "China", 'OriginCountryCode' => "CN")); } } sort($item); //EUB异常订单申请订单,修改料号,没有对应的物品交易号,不能申请跟踪号问题解决 $params = array('Version' => "3.0.0", 'APIDevUserID' => $APIDevUserID, 'APIPassword' => $APIPassword, 'APISellerUserID' => $APISellerUserID, 'MessageID' => "135625622432", "OrderDetail" => array("PickUpAddress" => $PickUpAddress, "ShipFromAddress" => $ShipFromAddress, "ShipToAddress" => $ShipToAddress, "ItemList" => array("Item" => $item), "EMSPickUpType" => $shiptype, "ReturnAddress" => $ReturnAddress));