public function send() { $this->attributes['ei']['action'] = 0; $this->attributes['ei']['isEnbaled'] = 'N'; $this->toBuildXML(); $data = $this->sign(); $http = new Http(); $return = $http->post($this->url . '/GetB2CInfos', $data); $xml = Utils::formatXML($return['data']); if (false !== strpos($xml, '未授权')) { throw new \Exception(sprintf('%s', "IP未授权,请联系宅急送客服!")); } return Utils::xml_to_array($xml); }
public function send() { $this->toBuildXML(); $data = $this->sign(); $http = new Http(); $return = $http->post($this->url . '/Get', $data); $xml = Utils::formatXML($return['data']); if (false !== strpos($xml, '未授权')) { throw new \Exception(sprintf('%s', "IP未授权,请联系宅急送客服!")); } $array = Utils::xml_to_array($xml); if (isset($array['BatchQueryResponse']['orders'])) { return $array['BatchQueryResponse']['orders']; } else { return false; } }
public function cancel() { $xml = '<?xml version="1.0" encoding="utf-8" ?><UpdateInfo><logisticProviderID>{logisticProviderID}</logisticProviderID><orderNo>{orderNo}</orderNo><infoType>INSTRUCTION</infoType><infoContent>WITHDRAW</infoContent></UpdateInfo>'; $this->xml = str_replace(array('{logisticProviderID}', '{orderNo}'), array($this->attributes['logisticProviderID'], $this->attributes['orderNo']), $xml); $data = $this->sign(); $http = new Http(); $return = $http->post($this->url . '/OrderXML', $data); $xml = Utils::formatXML($return['data']); if (false !== strpos($xml, '未授权')) { throw new \Exception(sprintf('%s', "IP未授权,请联系宅急送客服!")); } return Utils::xml_to_array($xml); }