Loading src/Service/Interfaces/Order/SubOrderServiceInterface.php +46 −0 Original line number Original line Diff line number Diff line Loading @@ -60,5 +60,51 @@ interface SubOrderServiceInterface public function getBySourceSite($source): array; public function getBySourceSite($source): array; /** * 订单采购完成 修改子订单信息 ---1688采购系统使用 * @param $data //修改参数数组(二维数组) * 参数字段:$data = [ * [ * 'sub_order_no'=>oa子订单编号 * 'supplier_name'=>供应商, * 'purchase_price'=>采购总价, * 'platform_order'=>'采购平台订单号', * 'domestic_logistics_no'=>物流单号, * 'domestic_logistics_price'=>物流价格 * ], * [ * 'sub_order_no'=>oa子订单编号 * 'supplier_name'=>供应商, * 'purchase_price'=>采购总价, * 'platform_order'=>'采购平台订单号', * 'domestic_logistics_no'=>物流单号, * 'domestic_logistics_price'=>物流价格 * ] * ] * @return bool */ public function purchaseCompleted($data): bool; /** * 1688采购异常订单 修改OA子订单状态 * @param $orderId //oa子订单id * @param $errorCode //异常信息 1 取消 2其他 * @return array */ public function purchaseError($orderId,$errorCode):array ; /** * 1688采购 修改oa子订单 * @param $editData * $editData = [ * [ * 'sub_order_no'=>'oa系统子订单号' * 'logistic_price'=>'物流费用', * 'purchase_price'=>'采购总费用', * ] * ] * @return array */ public function purchaseEdit($editData):array ; } } No newline at end of file src/Service/Interfaces/Product/ProductServiceInterface.php +7 −0 Original line number Original line Diff line number Diff line Loading @@ -148,4 +148,11 @@ interface ProductServiceInterface */ */ public function getSizesById($id): array; public function getSizesById($id): array; /** * 完成产品审批 * @param $data * @author Zero */ public function downApprove($data); } } src/Tools/CurlRequest.php +5 −30 Original line number Original line Diff line number Diff line Loading @@ -9,27 +9,17 @@ class CurlRequest protected static function init($url, $httpHeaders = []) protected static function init($url, $httpHeaders = []) { { // Create Curl resource $ch = curl_init(); $ch = curl_init(); // Set URL curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_URL, $url); //Return the transfer as a string curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_USERAGENT, 'PHPClassic/PHPShopify'); curl_setopt($ch, CURLOPT_USERAGENT, 'PHPClassic/PHPShopify'); $headers = []; $headers = []; foreach ($httpHeaders as $key => $value) { foreach ($httpHeaders as $key => $value) { $headers[] = "$key: $value"; $headers[] = "$key: $value"; } } //Set HTTP Headers curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); return $ch; return $ch; } } public static function get($url, $httpHeaders = []) public static function get($url, $httpHeaders = []) Loading Loading @@ -63,35 +53,20 @@ class CurlRequest protected static function processRequest($ch) protected static function processRequest($ch) { { # Check for 429 leaky bucket error while (1) { $output = curl_exec($ch); $output = curl_exec($ch); $response = new CurlResponse($output); $response = new CurlResponse($output); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); if ($httpCode != 429) { if ($httpCode == 429) { break; } $limitHeader = explode('/', $response->getHeader('X-Shopify-Shop-Api-Call-Limit'), 2); $limitHeader = explode('/', $response->getHeader('X-Shopify-Shop-Api-Call-Limit'), 2); if (isset($limitHeader[1]) && $limitHeader[0] < $limitHeader[1]) { if (isset($limitHeader[1]) && $limitHeader[0] < $limitHeader[1]) { throw new Exception($response->getBody()); throw new Exception($response->getBody()); } } usleep(500000); } } if (curl_errno($ch)) { if (curl_errno($ch)) { throw new Exception(curl_errno($ch) . ' : ' . curl_error($ch)); throw new Exception(curl_errno($ch) . ' : ' . curl_error($ch)); } } // close curl resource to free up system resources curl_close($ch); curl_close($ch); return [$httpCode, $response->getHeaders(), $response->getBody()]; $httpHeader = $response->getHeaders(); return [$httpCode, $httpHeader, $response->getBody()]; } } } } Loading
src/Service/Interfaces/Order/SubOrderServiceInterface.php +46 −0 Original line number Original line Diff line number Diff line Loading @@ -60,5 +60,51 @@ interface SubOrderServiceInterface public function getBySourceSite($source): array; public function getBySourceSite($source): array; /** * 订单采购完成 修改子订单信息 ---1688采购系统使用 * @param $data //修改参数数组(二维数组) * 参数字段:$data = [ * [ * 'sub_order_no'=>oa子订单编号 * 'supplier_name'=>供应商, * 'purchase_price'=>采购总价, * 'platform_order'=>'采购平台订单号', * 'domestic_logistics_no'=>物流单号, * 'domestic_logistics_price'=>物流价格 * ], * [ * 'sub_order_no'=>oa子订单编号 * 'supplier_name'=>供应商, * 'purchase_price'=>采购总价, * 'platform_order'=>'采购平台订单号', * 'domestic_logistics_no'=>物流单号, * 'domestic_logistics_price'=>物流价格 * ] * ] * @return bool */ public function purchaseCompleted($data): bool; /** * 1688采购异常订单 修改OA子订单状态 * @param $orderId //oa子订单id * @param $errorCode //异常信息 1 取消 2其他 * @return array */ public function purchaseError($orderId,$errorCode):array ; /** * 1688采购 修改oa子订单 * @param $editData * $editData = [ * [ * 'sub_order_no'=>'oa系统子订单号' * 'logistic_price'=>'物流费用', * 'purchase_price'=>'采购总费用', * ] * ] * @return array */ public function purchaseEdit($editData):array ; } } No newline at end of file
src/Service/Interfaces/Product/ProductServiceInterface.php +7 −0 Original line number Original line Diff line number Diff line Loading @@ -148,4 +148,11 @@ interface ProductServiceInterface */ */ public function getSizesById($id): array; public function getSizesById($id): array; /** * 完成产品审批 * @param $data * @author Zero */ public function downApprove($data); } }
src/Tools/CurlRequest.php +5 −30 Original line number Original line Diff line number Diff line Loading @@ -9,27 +9,17 @@ class CurlRequest protected static function init($url, $httpHeaders = []) protected static function init($url, $httpHeaders = []) { { // Create Curl resource $ch = curl_init(); $ch = curl_init(); // Set URL curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_URL, $url); //Return the transfer as a string curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_USERAGENT, 'PHPClassic/PHPShopify'); curl_setopt($ch, CURLOPT_USERAGENT, 'PHPClassic/PHPShopify'); $headers = []; $headers = []; foreach ($httpHeaders as $key => $value) { foreach ($httpHeaders as $key => $value) { $headers[] = "$key: $value"; $headers[] = "$key: $value"; } } //Set HTTP Headers curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); return $ch; return $ch; } } public static function get($url, $httpHeaders = []) public static function get($url, $httpHeaders = []) Loading Loading @@ -63,35 +53,20 @@ class CurlRequest protected static function processRequest($ch) protected static function processRequest($ch) { { # Check for 429 leaky bucket error while (1) { $output = curl_exec($ch); $output = curl_exec($ch); $response = new CurlResponse($output); $response = new CurlResponse($output); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); if ($httpCode != 429) { if ($httpCode == 429) { break; } $limitHeader = explode('/', $response->getHeader('X-Shopify-Shop-Api-Call-Limit'), 2); $limitHeader = explode('/', $response->getHeader('X-Shopify-Shop-Api-Call-Limit'), 2); if (isset($limitHeader[1]) && $limitHeader[0] < $limitHeader[1]) { if (isset($limitHeader[1]) && $limitHeader[0] < $limitHeader[1]) { throw new Exception($response->getBody()); throw new Exception($response->getBody()); } } usleep(500000); } } if (curl_errno($ch)) { if (curl_errno($ch)) { throw new Exception(curl_errno($ch) . ' : ' . curl_error($ch)); throw new Exception(curl_errno($ch) . ' : ' . curl_error($ch)); } } // close curl resource to free up system resources curl_close($ch); curl_close($ch); return [$httpCode, $response->getHeaders(), $response->getBody()]; $httpHeader = $response->getHeaders(); return [$httpCode, $httpHeader, $response->getBody()]; } } } }