当前位置: 首页>>代码示例>>PHP>>正文


PHP Mage_Shipping_Model_Rate_Result::append方法代码示例

本文整理汇总了PHP中Mage_Shipping_Model_Rate_Result::append方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Shipping_Model_Rate_Result::append方法的具体用法?PHP Mage_Shipping_Model_Rate_Result::append怎么用?PHP Mage_Shipping_Model_Rate_Result::append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mage_Shipping_Model_Rate_Result的用法示例。


在下文中一共展示了Mage_Shipping_Model_Rate_Result::append方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _appendShippingErrors

 /**
  * Some special errors must be sent to users.
  * If not applicable, the default error will be sent.
  * 
  * @param array $errorList Error List
  * 
  * @return boolean
  */
 protected function _appendShippingErrors($errorList)
 {
     $output = false;
     $successCode = '0';
     $hasValidQuote = array_key_exists($successCode, $errorList);
     if (!$hasValidQuote) {
         $displayErrorList = explode(',', $this->getConfigData('hard_errors'));
         if ($this->getConfigFlag('show_soft_errors')) {
             $softErrorList = explode(',', $this->getConfigData('soft_errors'));
             $displayErrorList = array_merge($displayErrorList, $softErrorList);
         }
         foreach ($errorList as $errorCode => $errorMsg) {
             $isDisplayError = in_array($errorCode, $displayErrorList);
             if ($isDisplayError) {
                 $error = Mage::getModel('shipping/rate_result_error');
                 $error->setCarrier($this->_code);
                 $error->setErrorMessage($errorMsg);
                 $this->_result->append($error);
                 $output = true;
             }
         }
         if (!$output) {
             $logMsg = implode(',', $errorList);
             Mage::log("{$this->_code}: Warning! There is no valid quotes, and no one error was throwed: {$logMsg}");
         }
     }
     return $output;
 }
开发者ID:NelisRodrigues,项目名称:correios,代码行数:36,代码来源:CorreiosMethod.php

示例2: _appendError

 /**
  * Adds the error message in the result
  *
  * @param Mage_Shipping_Model_Rate_Result $result
  * @param string $message
  * @return Storm_Correios_Model_Carrier_Shipping
  */
 protected function _appendError(Mage_Shipping_Model_Rate_Result &$result, $message)
 {
     $this->_getHelper()->log($message);
     $error = Mage::getModel('shipping/rate_result_error');
     $error->setCarrier($this->_code)->setCarrierTitle($this->getConfigData('title'))->setErrorMessage($message);
     $result->append($error);
     return $this;
 }
开发者ID:elderxavier,项目名称:correios,代码行数:15,代码来源:Shipping.php

示例3: _appendShippingWarning

 /**
  * Add a warning message at the top of the shipping method list.
  *
  * @param SimpleXMLElement $servico Post Method
  *
  * @return boolean
  */
 protected function _appendShippingWarning(SimpleXMLElement $servico)
 {
     $id = (string) $servico->Erro;
     $ids = explode(',', $this->getConfigData('soft_errors'));
     if (in_array($id, $ids)) {
         $error = Mage::getModel('shipping/rate_result_error');
         $error->setCarrier($this->_code);
         $error->setErrorMessage($servico->MsgErro);
         $this->_result->append($error);
         return true;
     }
     return false;
 }
开发者ID:rafaelmsantiago,项目名称:correios,代码行数:20,代码来源:CorreiosMethod.php

示例4: _getTracking

 /**
  * Protected Get Tracking, opens the request to Correios
  *
  * @param string $code Code
  *
  * @return bool
  */
 protected function _getTracking($code)
 {
     $error = Mage::getModel('shipping/tracking_result_error');
     $error->setTracking($code);
     $error->setCarrier($this->_code);
     $error->setCarrierTitle($this->getConfigData('title'));
     $error->setErrorMessage($this->getConfigData('urlerror'));
     $curl = curl_init();
     curl_setopt($curl, CURLOPT_URL, "https://fastshipping.ciawn.com.br/v1/tracking/" . $code . "?token=" . $this->_token);
     curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
     curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
     $response = curl_exec($curl);
     curl_close($curl);
     $response = json_decode($response)->result;
     $progress = array();
     foreach ($response as $key => $item) {
         $datetime = explode(' ', $item->data);
         $locale = new Zend_Locale('pt_BR');
         $date = '';
         $date = new Zend_Date($datetime[0], 'dd/MM/YYYY', $locale);
         $track = array('deliverydate' => $date->toString('YYYY-MM-dd'), 'deliverytime' => $datetime[1] . ':00', 'deliverylocation' => $item->local, 'status' => $item->acao, 'activity' => $item->detalhes);
         $progress[] = $track;
     }
     if (!empty($progress)) {
         $track = $progress[0];
         $track['progressdetail'] = $progress;
         $tracking = Mage::getModel('shipping/tracking_result_status');
         $tracking->setTracking($code);
         $tracking->setCarrier($this->_code);
         $tracking->setCarrierTitle($this->getConfigData('title'));
         $tracking->addData($track);
         $this->_result->append($tracking);
         return true;
     } else {
         $this->_result->append($error);
         return false;
     }
 }
开发者ID:FastShipping,项目名称:fastshipping-magento,代码行数:46,代码来源:CorreiosMethod.php

示例5: _parseXmlTrackingResponse

 /**
  * Parse xml tracking response
  *
  * @deprecated after 1.6.0.0 see _parseTrackingResponse()
  * @param array $trackingvalue
  * @param string $response
  * @return void
  */
 protected function _parseXmlTrackingResponse($trackingvalue, $response)
 {
     $resultArr = array();
     if (strlen(trim($response)) > 0) {
         if ($xml = $this->_parseXml($response)) {
             if (is_object($xml->Error) && is_object($xml->Error->Message)) {
                 $errorTitle = (string) $xml->Error->Message;
             } elseif (is_object($xml->SoftError) && is_object($xml->SoftError->Message)) {
                 $errorTitle = (string) $xml->SoftError->Message;
             }
             if (!isset($errorTitle)) {
                 $resultArr['status'] = (string) $xml->Package->StatusDescription;
                 $resultArr['service'] = (string) $xml->Package->Service;
                 $resultArr['deliverydate'] = (string) $xml->Package->DeliveredDate;
                 $resultArr['deliverytime'] = (string) $xml->Package->DeliveredTime;
                 $resultArr['deliverylocation'] = (string) $xml->TrackProfile->DeliveredLocationDescription;
                 $resultArr['signedby'] = (string) $xml->Package->SignedForBy;
                 $resultArr['shippeddate'] = (string) $xml->Package->ShipDate;
                 $weight = (string) $xml->Package->Weight;
                 $unit = (string) $xml->Package->WeightUnits;
                 $resultArr['weight'] = "{$weight} {$unit}";
                 $packageProgress = array();
                 if (isset($xml->Package->Event)) {
                     foreach ($xml->Package->Event as $event) {
                         $tempArr = array();
                         $tempArr['activity'] = (string) $event->Description;
                         $tempArr['deliverydate'] = (string) $event->Date;
                         //YYYY-MM-DD
                         $tempArr['deliverytime'] = (string) $event->Time;
                         //HH:MM:ss
                         $addArr = array();
                         if (isset($event->Address->City)) {
                             $addArr[] = (string) $event->Address->City;
                         }
                         if (isset($event->Address->StateProvinceCode)) {
                             $addArr[] = (string) $event->Address->StateProvinceCode;
                         }
                         if (isset($event->Address->CountryCode)) {
                             $addArr[] = (string) $event->Address->CountryCode;
                         }
                         if ($addArr) {
                             $tempArr['deliverylocation'] = implode(', ', $addArr);
                         }
                         $packageProgress[] = $tempArr;
                     }
                 }
                 $resultArr['progressdetail'] = $packageProgress;
             }
         } else {
             $errorTitle = 'Response is in the wrong format';
         }
     } else {
         $errorTitle = false;
     }
     if (!$this->_result) {
         $this->_result = Mage::getModel('shipping/tracking_result');
     }
     if ($resultArr) {
         $tracking = Mage::getModel('shipping/tracking_result_status');
         $tracking->setCarrier('fedex');
         $tracking->setCarrierTitle($this->getConfigData('title'));
         $tracking->setTracking($trackingvalue);
         $tracking->addData($resultArr);
         $this->_result->append($tracking);
     } else {
         $error = Mage::getModel('shipping/tracking_result_error');
         $error->setCarrier('fedex');
         $error->setCarrierTitle($this->getConfigData('title'));
         $error->setTracking($trackingvalue);
         $error->setErrorMessage($errorTitle ? $errorTitle : Mage::helper('usa')->__('Unable to retrieve tracking'));
         $this->_result->append($error);
     }
 }
开发者ID:sshegde123,项目名称:wmp8,代码行数:81,代码来源:Fedex.php

示例6: _parseXmlTrackingResponse

 /**
  * Parse xml tracking response
  *
  * @param array $trackingValue
  * @param string $response
  * @return null
  */
 protected function _parseXmlTrackingResponse($trackingValue, $response)
 {
     $errorTitle = Mage::helper('usa')->__('Unable to retrieve tracking');
     $resultArr = array();
     if (strlen(trim($response)) > 0) {
         if (strpos(trim($response), '<?xml') === 0) {
             $xml = simplexml_load_string($response);
             if (is_object($xml)) {
                 if (isset($xml->Number) && isset($xml->Description) && (string) $xml->Description != '') {
                     $errorTitle = (string) $xml->Description;
                 } elseif (isset($xml->TrackInfo) && isset($xml->TrackInfo->Error) && isset($xml->TrackInfo->Error->Description) && (string) $xml->TrackInfo->Error->Description != '') {
                     $errorTitle = (string) $xml->TrackInfo->Error->Description;
                 } else {
                     $errorTitle = Mage::helper('usa')->__('Unknown error');
                 }
                 if (isset($xml->TrackInfo) && isset($xml->TrackInfo->TrackSummary)) {
                     $resultArr['tracksummary'] = (string) $xml->TrackInfo->TrackSummary;
                 }
             }
         }
     }
     if (!$this->_result) {
         $this->_result = Mage::getModel('shipping/tracking_result');
     }
     if ($resultArr) {
         $tracking = Mage::getModel('shipping/tracking_result_status');
         $tracking->setCarrier('usps');
         $tracking->setCarrierTitle($this->getConfigData('title'));
         $tracking->setTracking($trackingValue);
         $tracking->setTrackSummary($resultArr['tracksummary']);
         $this->_result->append($tracking);
     } else {
         $error = Mage::getModel('shipping/tracking_result_error');
         $error->setCarrier('usps');
         $error->setCarrierTitle($this->getConfigData('title'));
         $error->setTracking($trackingValue);
         $error->setErrorMessage($errorTitle);
         $this->_result->append($error);
     }
 }
开发者ID:nja78,项目名称:Magento-Pre-Patched-Files,代码行数:47,代码来源:Usps.php

示例7: _getQuotes

 protected function _getQuotes($extraCover, $config)
 {
     $destCountry = $config['country_code'];
     try {
         if ($destCountry == Fontis_Australia_Helper_Data::AUSTRALIA_COUNTRY_CODE) {
             $services = $this->_client->listDomesticParcelServices($config);
         } else {
             $services = $this->_client->listInternationalParcelServices($config);
         }
     } catch (Exception $e) {
         Mage::logException($e);
         return;
     }
     // TODO: Clean up this logic
     $allowedMethods = $this->getAllowedMethods();
     $extraCoverParent = $this->getCode('extra_cover');
     foreach ($services['services']['service'] as $service) {
         $serviceCode = $service['code'];
         // e.g. AUS_PARCEL_REGULAR
         if (in_array($serviceCode, $allowedMethods)) {
             $serviceName = $service['name'];
             // e.g. Parcel Post
             $servicePrice = $service['price'];
             // Just add the shipping method if the call to Australia Post
             // returns no options for that method
             if (!isset($service['options']['option']) && $this->_isAvailableShippingMethod($serviceName, $destCountry)) {
                 $method = $this->createMethod($serviceCode, $serviceName, $servicePrice);
                 $this->_result->append($method);
                 // If a shipping method has a bunch of options, we will have to
                 // create a specific method for each of the variants
             } else {
                 $serviceOption = $service['options']['option'];
                 // Unlike domestic shipping methods where the "default"
                 // method is listed as simply another service option (this
                 // allows us to simply loop through each one), we have to
                 // extrapolate the default international shipping method
                 // from what we know about the service itself
                 if ($destCountry != Fontis_Australia_Helper_Data::AUSTRALIA_COUNTRY_CODE && $this->_isAvailableShippingMethod($serviceName, $destCountry)) {
                     $method = $this->createMethod($serviceCode, $serviceName, $servicePrice);
                     $this->_result->append($method);
                 }
                 // Checks to see if the API has returned either a single
                 // service option or an array of them. If it is a single
                 // option then turn it into an array.
                 if (isset($serviceOption['name'])) {
                     $serviceOption = array($serviceOption);
                 }
                 foreach ($serviceOption as $option) {
                     $serviceOptionName = $option['name'];
                     $serviceOptionCode = $option['code'];
                     $config = array_merge($config, array('service_code' => $serviceCode, 'option_code' => $serviceOptionCode, 'extra_cover' => $extraCover));
                     try {
                         if ($destCountry == Fontis_Australia_Helper_Data::AUSTRALIA_COUNTRY_CODE) {
                             $postage = $this->_client->calculateDomesticParcelPostage($config);
                         } else {
                             $postage = $this->_client->calculateInternationalParcelPostage($config);
                         }
                     } catch (Exception $e) {
                         continue;
                     }
                     $servicePrice = $postage['postage_result']['total_cost'];
                     /** @var Fontis_Australia_Helper_Clickandsend $clickandsendHelper */
                     $clickandsendHelper = Mage::helper('australia/clickandsend');
                     // Create a shipping method with only the top-level options
                     $_finalCode = $serviceCode . '_' . $serviceOptionCode;
                     $_finalName = $serviceName . ' (' . $serviceOptionName . ')';
                     if ($this->_isAvailableShippingMethod($_finalName, $destCountry) && !(in_array($serviceOptionCode, $clickandsendHelper->getDisallowedServiceOptions()) && in_array($serviceCode, $clickandsendHelper->getDisallowedServiceCodes()) && $clickandsendHelper->isClickAndSendEnabled() && $clickandsendHelper->isFilterShippingMethods())) {
                         $method = $this->createMethod($_finalCode, $_finalName, $servicePrice);
                         $this->_result->append($method);
                     }
                     // Add the extra cover options (these are suboptions of
                     // the top-level options)
                     if (array_key_exists($serviceOptionCode, $extraCoverParent) && !($clickandsendHelper->isClickAndSendEnabled() && $clickandsendHelper->isFilterShippingMethods())) {
                         try {
                             if ($destCountry == Fontis_Australia_Helper_Data::AUSTRALIA_COUNTRY_CODE) {
                                 $config = array_merge($config, array('suboption_code' => ServiceOption::AUS_SERVICE_OPTION_EXTRA_COVER));
                                 $postageWithExtraCover = $this->_client->calculateDomesticParcelPostage($config);
                             } else {
                                 $postageWithExtraCover = $this->_client->calculateInternationalParcelPostage($config);
                             }
                             unset($config['suboption_code']);
                         } catch (Exception $e) {
                             continue;
                         }
                         if ($serviceOptionName == 'Signature on Delivery') {
                             $serviceOptionName = $serviceOptionName . ' + Extra Cover';
                         } else {
                             $serviceOptionName = 'Extra Cover';
                         }
                         if ($serviceOptionCode == ServiceOption::AUS_SERVICE_OPTION_SIGNATURE_ON_DELIVERY) {
                             $serviceOptionCode = 'FULL_PACKAGE';
                         } else {
                             $serviceOptionCode = 'EXTRA_COVER';
                         }
                         $servicePrice = $postageWithExtraCover['postage_result']['total_cost'];
                         $_finalCode = $serviceCode . '_' . $serviceOptionCode;
                         $_finalName = $serviceName . ' (' . $serviceOptionName . ')';
                         if ($this->_isAvailableShippingMethod($_finalName, $destCountry)) {
                             $method = $this->createMethod($_finalCode, $_finalName, $servicePrice);
                             $this->_result->append($method);
//.........这里部分代码省略.........
开发者ID:rob3000,项目名称:fontis_australia,代码行数:101,代码来源:Australiapost.php

示例8: _parseTrackingResponse

 /**
  * Parse tracking response
  *
  * @param array $trackingValue
  * @param stdClass $response
  */
 protected function _parseTrackingResponse($trackingValue, $response)
 {
     if (is_object($response)) {
         if ($response->HighestSeverity == 'FAILURE' || $response->HighestSeverity == 'ERROR') {
             $errorTitle = (string) $response->Notifications->Message;
         } elseif (isset($response->TrackDetails)) {
             $trackInfo = $response->TrackDetails;
             $resultArray['status'] = (string) $trackInfo->StatusDescription;
             $resultArray['service'] = (string) $trackInfo->ServiceInfo;
             $timestamp = isset($trackInfo->EstimatedDeliveryTimestamp) ? $trackInfo->EstimatedDeliveryTimestamp : $trackInfo->ActualDeliveryTimestamp;
             $timestamp = strtotime((string) $timestamp);
             if ($timestamp) {
                 $resultArray['deliverydate'] = date('Y-m-d', $timestamp);
                 $resultArray['deliverytime'] = date('H:i:s', $timestamp);
             }
             $deliveryLocation = isset($trackInfo->EstimatedDeliveryAddress) ? $trackInfo->EstimatedDeliveryAddress : $trackInfo->ActualDeliveryAddress;
             $deliveryLocationArray = array();
             if (isset($deliveryLocation->City)) {
                 $deliveryLocationArray[] = (string) $deliveryLocation->City;
             }
             if (isset($deliveryLocation->StateOrProvinceCode)) {
                 $deliveryLocationArray[] = (string) $deliveryLocation->StateOrProvinceCode;
             }
             if (isset($deliveryLocation->CountryCode)) {
                 $deliveryLocationArray[] = (string) $deliveryLocation->CountryCode;
             }
             if ($deliveryLocationArray) {
                 $resultArray['deliverylocation'] = implode(', ', $deliveryLocationArray);
             }
             $resultArray['signedby'] = (string) $trackInfo->DeliverySignatureName;
             $resultArray['shippeddate'] = date('Y-m-d', (int) $trackInfo->ShipTimestamp);
             if (isset($trackInfo->PackageWeight) && isset($trackInfo->Units)) {
                 $weight = (string) $trackInfo->PackageWeight;
                 $unit = (string) $trackInfo->Units;
                 $resultArray['weight'] = "{$weight} {$unit}";
             }
             $packageProgress = array();
             if (isset($trackInfo->Events)) {
                 $events = $trackInfo->Events;
                 if (isset($events->Address)) {
                     $events = array($events);
                 }
                 foreach ($events as $event) {
                     $tempArray = array();
                     $tempArray['activity'] = (string) $event->EventDescription;
                     $timestamp = strtotime((string) $event->Timestamp);
                     if ($timestamp) {
                         $tempArray['deliverydate'] = date('Y-m-d', $timestamp);
                         $tempArray['deliverytime'] = date('H:i:s', $timestamp);
                     }
                     if (isset($event->Address)) {
                         $addressArray = array();
                         $address = $event->Address;
                         if (isset($address->City)) {
                             $addressArray[] = (string) $address->City;
                         }
                         if (isset($address->StateOrProvinceCode)) {
                             $addressArray[] = (string) $address->StateOrProvinceCode;
                         }
                         if (isset($address->CountryCode)) {
                             $addressArray[] = (string) $address->CountryCode;
                         }
                         if ($addressArray) {
                             $tempArray['deliverylocation'] = implode(', ', $addressArray);
                         }
                     }
                     $packageProgress[] = $tempArray;
                 }
             }
             $resultArray['progressdetail'] = $packageProgress;
         }
     }
     if (!$this->_result) {
         $this->_result = Mage::getModel('Mage_Shipping_Model_Tracking_Result');
     }
     if (isset($resultArray)) {
         $tracking = Mage::getModel('Mage_Shipping_Model_Tracking_Result_Status');
         $tracking->setCarrier('fedex');
         $tracking->setCarrierTitle($this->getConfigData('title'));
         $tracking->setTracking($trackingValue);
         $tracking->addData($resultArray);
         $this->_result->append($tracking);
     } else {
         $error = Mage::getModel('Mage_Shipping_Model_Tracking_Result_Error');
         $error->setCarrier('fedex');
         $error->setCarrierTitle($this->getConfigData('title'));
         $error->setTracking($trackingValue);
         $error->setErrorMessage($errorTitle ? $errorTitle : Mage::helper('Mage_Usa_Helper_Data')->__('Unable to retrieve tracking'));
         $this->_result->append($error);
     }
 }
开发者ID:natxetee,项目名称:magento2,代码行数:97,代码来源:Fedex.php

示例9: _getTracking

 /**
  * Protected Get Tracking, opens the request to Correios
  *
  * @param string $code
  *
  * @return bool
  */
 protected function _getTracking($code)
 {
     $error = Mage::getModel('shipping/tracking_result_error');
     $error->setTracking($code);
     $error->setCarrier($this->_code);
     $error->setCarrierTitle($this->getConfigData('title'));
     $error->setErrorMessage($this->getConfigData('urlerror'));
     $url = 'http://websro.correios.com.br/sro_bin/txect01$.QueryList';
     $url .= '?P_LINGUA=001&P_TIPO=001&P_COD_UNI=' . $code;
     try {
         $client = new Zend_Http_Client();
         $client->setUri($url);
         $content = $client->request();
         $body = $content->getBody();
     } catch (Exception $e) {
         $this->_result->append($error);
         return false;
     }
     if (!preg_match('#<table ([^>]+)>(.*?)</table>#is', $body, $matches)) {
         $this->_result->append($error);
         return false;
     }
     $table = $matches[2];
     if (!preg_match_all('/<tr>(.*)<\\/tr>/i', $table, $columns, PREG_SET_ORDER)) {
         $this->_result->append($error);
         return false;
     }
     $progress = array();
     for ($i = 0; $i < count($columns); $i++) {
         $column = $columns[$i][1];
         $description = '';
         $found = false;
         if (preg_match('/<td rowspan="?2"?/i', $column) && preg_match('/<td rowspan="?2"?>(.*)<\\/td><td>(.*)<\\/td><td><font color="[A-Z0-9]{6}">(.*)<\\/font><\\/td>/i', $column, $matches)) {
             if (preg_match('/<td colspan="?2"?>(.*)<\\/td>/i', $columns[$i + 1][1], $matchesDescription)) {
                 $description = str_replace('  ', '', $matchesDescription[1]);
             }
             $found = true;
         } elseif (preg_match('/<td rowspan="?1"?>(.*)<\\/td><td>(.*)<\\/td><td><font color="[A-Z0-9]{6}">(.*)<\\/font><\\/td>/i', $column, $matches)) {
             $found = true;
         }
         if ($found) {
             $datetime = explode(' ', $matches[1]);
             $locale = new Zend_Locale('pt_BR');
             $date = '';
             $date = new Zend_Date($datetime[0], 'dd/MM/YYYY', $locale);
             $track = array('deliverydate' => $date->toString('YYYY-MM-dd'), 'deliverytime' => $datetime[1] . ':00', 'deliverylocation' => htmlentities($matches[2]), 'status' => htmlentities($matches[3]), 'activity' => htmlentities($matches[3]));
             if ($description !== '') {
                 $track['activity'] = $matches[3] . ' - ' . htmlentities($description);
             }
             $progress[] = $track;
         }
     }
     if (!empty($progress)) {
         $track = $progress[0];
         $track['progressdetail'] = $progress;
         $tracking = Mage::getModel('shipping/tracking_result_status');
         $tracking->setTracking($code);
         $tracking->setCarrier('correios');
         $tracking->setCarrierTitle($this->getConfigData('title'));
         $tracking->addData($track);
         $this->_result->append($tracking);
         return true;
     } else {
         $this->_result->append($error);
         return false;
     }
 }
开发者ID:danielwalterrodrigues,项目名称:asus,代码行数:74,代码来源:CorreiosMethod.php


注:本文中的Mage_Shipping_Model_Rate_Result::append方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。